Rafael Azevedo <RafaelAzev...@discussions.microsoft.com> wrote...
>I have a similar question, but what I am looking for is:
In this case it would have been best if you had started a new thread/
topic and perhaps included a link to this thread rather than replying
in this thread.
>I have several cells with comments and I would like to extract only an
>alphanumeric part number that follows this format (2letters followed by 5
>numbers):
....
>The problem is that I am trying to use SEARCH function but if there is any
>word that contains ST will give me the wrong MID point.
>Example of a comment:
>"Change Request Main_20847 - ST11223 Machine Holder/ Blade Tip Grinder"
>
>I am looking for extracting only ST11223 from the text above, but the word
>"Request" also contains ST on it.
....
Would it be correct to say the 'ST' you want to find would always be
preceded by a space and followed by 5 decimal numerals then another
space? If so, regular expressions would be easiest, but they require
either VBA or add-ins. But there's a way to do this using just built-
in functions and a defined name.
Define seq referring to the formula
=ROW(INDEX($1:$65536,1,1):INDEX($1:$65536,256,1))
Then, if the record you're parsing were in cell C3, try the following
array formula.
=MID(C3,MATCH(9,MMULT(--(ABS(CODE(MID(" "&UPPER(C3)&REPT(" ",255),
seq+{0,1,2,3,4,5,6,7,8},1))-{32,83,84,52.5,52.5,52.5,52.5,52.5,32})
<{1,1,1,5,5,5,5,5,1}),{1;1;1;1;1;1;1;1;1}),0),7)
If you're willing to go the add-in/reguar expression route, download
and install Laurent Longre's MOREFUNC.XLL add-in from
http://xcell05.free.fr/morefunc/english/index.htm
and use its REGEX.MID function as follows.
=REGEX.MID(C3,"\bST\d{5}\b",1,0)