nburaq
Board Regular
- Joined
- Apr 2, 2021
- Messages
- 220
- Office Version
- 365
- 2019
- Platform
- Windows
Hi Gents,
I have table shown below and I would like to format the text shown in column A like in column B. I have done this by extremely crazy formula took almost 1 hour to do it but I am pretty sure there are some clever guys who can do this in a shorter way ! PS: be careful with quotation marks in cells also words before numbers may vary ( I have managed to do it with two words before number starts)
Good Luck Gents!
I have table shown below and I would like to format the text shown in column A like in column B. I have done this by extremely crazy formula took almost 1 hour to do it but I am pretty sure there are some clever guys who can do this in a shorter way ! PS: be careful with quotation marks in cells also words before numbers may vary ( I have managed to do it with two words before number starts)
Good Luck Gents!
sample.xlsx | ||||
---|---|---|---|---|
A | B | |||
1 | Text | Mod Text | ||
2 | Line 2-NC-81-806-D21 | 2"-NC-81-806-D21 | ||
3 | Gas Line 4"-NG-81-003-F83S | 4"-NG-81-003-F83S | ||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B2:B3 | B2 | =IF(COUNTIF(A2,"*"&CHAR(34)&"*")=0,SUBSTITUTE(IF(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))=1,MID(TRIM(A2),1+FIND("~",SUBSTITUTE(TRIM(A2)," ","~",1)),255),MID(TRIM(A2),1+FIND("~",SUBSTITUTE(TRIM(A2)," ","~",2)),255)),"-","""-",1),MID(TRIM(A2),1+FIND("~",SUBSTITUTE(TRIM(A2)," ","~",2)),255)) |