If have a similiar task like in this thread (Help extracting a particular string of text from a cell).
But it is a bit of a harder nut (for me). I try to explain; the content of the Data-Cell could look like this examples (between "" the content, the desired output bold):Trying to sythesize I like to extract the first number after the String "CR " and before the comma (variant A) or semicolon (variant B).
- "abcxyz" -> "" (Nothing)
- "CR 256"
- "CR 256, 278, 296"
- "CR 256,278,296"
- "CR 256; XYZ 412, 478"
- "CR 256, 278, 296; XYZ 412, 478"
- "ABC 1232, 1468; CR 1256, 1278, 1296"
- "ABC 1232, 1468; CR 1256, 1278, 1296; XYZ 412, 478"
- "ABC 1232, 1468; CR 1256; XYZ 412, 478"
I was able to find a solution to extract the string before the semicolon (or end of string) if there is nothing before the string "CR " with this code (working for example 1-2 & 5, working in part for example 3, 4 & 6, not working for example 7-9):
![]()
=TRIM(MID(Cell,FIND("CR ",Cell)+3,FIND(";",Cell&";")-FIND("CR ",Cell)-3))
I hope the masters of Excel code give me a help in this.
See post # 7 for better outlined examples and limitations.
Bookmarks