I have a sheet of text strings like the example:
06767996*Seg 010 Bligh St*Ernest Phillips Ave*Cooma*Adams Avenue Cooma*0.08
Where I want to extract the text between the last and second last astrix using excel formula. Any suggestions?
I have a sheet of text strings like the example:
06767996*Seg 010 Bligh St*Ernest Phillips Ave*Cooma*Adams Avenue Cooma*0.08
Where I want to extract the text between the last and second last astrix using excel formula. Any suggestions?
Try the following User Defined Function:
Public Function NextToLast(sin As String) As String
arr = Split(sin, "*")
NextToLast = arr(UBound(arr) - 1)
End Function
User Defined Functions (UDFs) are very easy to install and use:
If you save the workbook, the UDF will be saved with it. If you are using a version of Excel later then 2003, you must save the file as .xlsm rather than .xlsx
To remove the UDF:
To use the UDF from Excel:
=myfunction(A1)
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
and for specifics on UDFs, see:
http://www.cpearson.com/excel/WritingFunctionsInVBA.aspx
Macros must be enabled for this to work!