Hi, I'm really hoping someone could assist with a method to deal with an issue I'm having with some text extraction.
I have a column of data and need to extract the MOT information. This could be "Exempt" or a date in the format of "Month Year" and this is the only part of the full text string I want to return to another column.
The data can vary and I have no control over this - this is a sample of rows of 4 differing formats I have had so far:
I have had some success with the following formula: =IF(TRIM(SUBSTITUTE(MID(A2,SEARCH("MOT: ",A2)+LEN("MOT: "),9),"•"," "))="Exempt","Exempt",TRIM(SUBSTITUTE(MID(A2,SEARCH("MOT: ",A2)+LEN("MOT: "),9),"•"," "))) but the problem I'm having is that there is not always a bullet point to use in counting my number of characters for the MID formula and using a fixed number of characters misses the end of the longer months or gives me too many if the the status is exempt.
Any ideas or a different approach would be appreciated.
Thank you.
I have a column of data and need to extract the MOT information. This could be "Exempt" or a date in the format of "Month Year" and this is the only part of the full text string I want to return to another column.
The data can vary and I have no control over this - this is a sample of rows of 4 differing formats I have had so far:
Registration No: AN01 ABC Tax: N/A MOT: Exempt • Formerly owned by 2 people • Original signage • History is unknown • Many receipts etc • |
Registration No: BR07 NIP Tax: 3 months • MOT: December 2021 • Current ownership since 2009 • Refurbished • |
Registration No: BTU 218X Tax: 6 Months • MOT: July 2022 Much restored with a lot of history |
Registration No: LUV 197T Tax: N/A CC: 175cc MOT: Exempt Motorcycle • Restored • Lightweight |
I have had some success with the following formula: =IF(TRIM(SUBSTITUTE(MID(A2,SEARCH("MOT: ",A2)+LEN("MOT: "),9),"•"," "))="Exempt","Exempt",TRIM(SUBSTITUTE(MID(A2,SEARCH("MOT: ",A2)+LEN("MOT: "),9),"•"," "))) but the problem I'm having is that there is not always a bullet point to use in counting my number of characters for the MID formula and using a fixed number of characters misses the end of the longer months or gives me too many if the the status is exempt.
Any ideas or a different approach would be appreciated.
Thank you.