Question : Extract Text from Excel Cell

I am trying to extract some information from a cell. Here is the text in a cell. I was able to extract other information where there is a line header, e.g 32A, 57D etc but when there is text, I am having some difficulty since the text is not consistent. I have change the font to Bold, which defines the text I am having difficulty with.

 The following message was Confirmed, {1:F01CRESUS33XXXX0000000000}{2:I202CITIUS33XXXXN}{3:{108:LS0304205693WP5C}}{4:
:20:LS0304205693WP5C
:21:NONREF
:32A:100615USD1000
:53B:/306271111
:57D://FW021000021
Chase Manhattan Bank New York        <------------------------
:58D:/9301011483
Gold Fund LLC and Co          <------------------------
:72:/BNF/FFC Chatham Asset High Yield
//Master Fund Ltd           <------------------------
//A/C no 002-03115-1-}   <------------------------

Answer : Extract Text from Excel Cell

I thought that looked familiar :)

This seems to work:

1) Select B2:G2

2) Enter this array formula:

{=RegExpFind(LEFT(A2,FIND("-}",A2)-1),"^[A-Z/].*$",,FALSE,,TRUE)}

To enter an array formula, do not enter the curly braces, and hit Ctrl+Shift+Enter instead of Enter to finish it off.  
Excel will then display those braces to indicate that it's an array formula.

That allows for up to 6 items to be returned.  In the sample workbook it looks like you never need more than 4.

If a line has, say, 3 lines returned, then the other three cells in the array will show an #N/A error

This array behavior of the formula is explained in my article http://www.experts-exchange.com/Programming/Languages/Visual_Basic/A_1336-Using-Regular-Expressions-in-Visual-Basic-for-Applications-and-Visual-Basic-6.html
Random Solutions  
 
programming4us programming4us