# 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
Jacques Geday

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

gowflow

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
Somewhere
Earth

I just want to pull the ABC 327996 out.
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
Let me rephrase:

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

and need to get this:
Mr John Smith
Somewhere
Earth

Is that what you want ?
gowflow

Sort of,

I have all this in A1:

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

and need to get this:

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

gowflow