You are on page 1of 1

http://www.freefileconvert.

com/

Press Alt+F11 and then press Alt, I, then M. This will insert a module. Paste th is code in there and then use the formula example I have given in the descriptio n. '------------------------------------------------------------------------------------------------------'***NEW FUNCTION*** 'Description: Separates Alphabetic and Numeric Data. (i.e. Alpha 123, Alpha123) ' True or 1 will return alphabet, False or 0 will return numeric 'Example: A1 value is Rob12Schiele34 ' =Sep(A1,1) Returns: RobSchiele ' =Sep(A1,0) Returns: 1234 Function Sep(txt As String, flg As Boolean) As String With CreateObject("VBScript.RegExp") .Pattern = IIf(flg = True, "\d+", "\D+") .Global = True Sep = .Replace(txt, "") End With End Function

Function removeSpecial(sInput As String) As String Dim sSpecialChars As String Dim i As Long sSpecialChars = "\/:*?""<>|-+ ' ,@." For i = 1 To Len(sSpecialChars) sInput = Replace$(sInput, Mid$(sSpecialChars, i, 1), " ") Next removeSpecial = sInput End Function

Step1: =sep(a1,0) step2: =sep(a1,1) =removeSpecial(C1) copy the if condition code =IF(LEN(C1)>10,RIGHT(C1,LEN(C1)-(LEN(C1)-10)),IF(LEN(C1)=10,C1,0))

You might also like