Avatar of anthonytr
anthonytr
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Excel formula to pull specific data from a string

Hi,

I have the following formula which looks for a specific string and then pulls data found to the right of the found string:

=MID(A1,FIND("ABC",A1)+3,LEN(A1))

The number which follows ABC is 6 numbers long and may have a space or not (ABC 000000 or ABC000000) .

Is it possible to to only return the 6 or 7 numbers after the ABC prefix and nothing else?

Thanks
Microsoft ExcelSpreadsheets

Avatar of undefined
Last Comment
Rgonzo1971

8/22/2022 - Mon
gowflow

yes
=TRIM(MID(A1,FIND("ABC",A1)+3,LEN(A1)))

gowflow
anthonytr

ASKER
Hi gowflow,

I still can't trim the characters after the ABC 000000 numbers.  See below:

1788 / 33000 / MCS 170315 PC NQ / ABC 327996
Mr John Smith
An Address
Another Address
Somewhere
Earth

I just want to pull the ABC 327996 out.
gowflow

sorry can you post a sample workbook its not clear as there are carriage returns and is what you posted all in 1 cell ?
gowflow
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
gowflow

Let me rephrase:

You have all this in A1
1788 / 33000 / MCS 170315 PC NQ / ABC 327996
 Mr John Smith
 An Address
 Another Address
 Somewhere
 Earth


and need to get this:
 Mr John Smith
 An Address
 Another Address
 Somewhere
 Earth

Is that what you want ?
gowflow
anthonytr

ASKER
Sort of,

I have all this in A1:

1788 / 33000 / MCS 170315 PC NQ / ABC 327996
 Mr John Smith
 An Address
 Another Address
 Somewhere
 Earth

and need to get this:

ABC 327996
gowflow

ok try this
=MID(A1,FIND("ABC",A1),SEARCH(" ",A1,FIND("ABC",A1)+4)-FIND("ABC",A1)-1)

gowflow
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.