Hello,
My goal is to show the text between the numbers. I think the problem I am having is with the Substitute function. I am finding I have to update it based on the number of spaces in the string. Substitute(text,old_text,new_text,[instance_num]
I started out with an Instance_num of 13 which worked 90% of the time. Then I found I had to change it from 13 to 12 or 11 to get some of the other examples to work.
I am confused as to why it doesn't work for all the entries.
Column B shows the results I want.
My goal is to show the text between the numbers. I think the problem I am having is with the Substitute function. I am finding I have to update it based on the number of spaces in the string. Substitute(text,old_text,new_text,[instance_num]
I started out with an Instance_num of 13 which worked 90% of the time. Then I found I had to change it from 13 to 12 or 11 to get some of the other examples to work.
I am confused as to why it doesn't work for all the entries.
Column B shows the results I want.
2022 Find characters in a string.xlsx | ||||
---|---|---|---|---|
A | B | |||
1 | 0000-111-222 Cat-00FT Sss/Bbb KD-HT PRIME SPF 1.11 1111 1111 111 0000-111-111 _______ 1111 1111 _______ | Cat-00FT Sss/Bbb KD-HT PRIME SPF | ||
2 | 0000-222-333 DOGSS DOVER PRIVACY PANEL 222.20 2 22 12 2222-333-444 _______ 9994 0 _______ | DOGSS DOVER PRIVACY PANEL | ||
3 | 0000-444-555 cow xXx Ooo 44.44 777 777 777- 0000-999-999 _______ 3000 33 _______ | cow xXx Ooo | ||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B1 | B1 | =MID(A1,FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-13),1),FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-8),1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-13),1)) |
B2 | B2 | =MID(A2,FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-12),1),FIND("~",SUBSTITUTE(A2," ","~",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-8),1)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-12),1)) |
B3 | B3 | =MID(A3,FIND("*",SUBSTITUTE(A3," ","*",LEN(A3)-LEN(SUBSTITUTE(A3," ",""))-11),1),FIND("~",SUBSTITUTE(A3," ","~",LEN(A3)-LEN(SUBSTITUTE(A3," ",""))-8),1)-FIND("*",SUBSTITUTE(A3," ","*",LEN(A3)-LEN(SUBSTITUTE(A3," ",""))-11),1)) |