作者JieJuen (David)
看板Office
标题[算表] EXCEL:反转字串
时间Thu Nov 29 15:38:00 2007
有监於有板友推荐VBA的好处
小小的练习一番
----------------
Public Function STRE(InString As String)
STRE = StrReverse(InString)
End Function
----------------
这样是不是偷懒@@
假设在B1要反转A1字串
B1
=STRE(A1)
对照一下公式解法好了
循环参照,启用反覆运算
D1=IF(C1,D1+1,0)
B1=IF($C$1,IF($D$1<LEN(A1),B1&MID(A1,LEN(A1)-$D$1,1),B1),"")
C1输入1後完成
这样不公平,VBA有这个函数XD
假设没有的话...
----------------------
Public Function STREV(InString As String)
Dim I As Integer
Dim OutString As String
OutString = ""
For I = 1 To Len(InString)
OutString = OutString + Mid(InString, Len(InString) - I + 1, 1)
Next
STREV = OutString
End Function
-----------------------
同样假设在B1要反转A1字串
B1
=STREV(A1)
以上参考Catbert大大的文章
3057 8/06 Catbert R: [算表] 如何用EXCEL公式函数挑字
------------------------
Public Function MidText(InString As String)
Dim i As Integer
Dim outString As String
outString = ""
For i = 1 To Len(InString)
If IsNumeric(Mid(InString, i, 1)) <> True Then
outString = outString & Mid(InString, i, 1)
End If
Next
MidText = outString
End Function
-------------------------
请各位不吝指教^^"
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.164.59.188