formula to return text in middle of cell

josh_m

Board Regular
Joined
Mar 26, 2009
Messages
81
I have a list that are all formatted the same:
12345 City, ST (status)

I want to pull out the City,ST from the list

I can do a find to find the start position and end position.
=find(" ",A1,1) to find start position (i need to use formula here b/c the # length is variable)
=find(" (",A1,1) to find end position

I just can't figure out how to combine these into 1 formula to return the City,ST piece

thanks in advance for any assistance!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try

=TRIM(MID(SUBSTITUTE(A1,"(",REPT(" ",LEN(A1))),C1+1,LEN(A1)))

thanks for the formula, I think this would work if the list was in sequential order. but the #'s are random (my fault, didn't think to mention that) I do appreciate you trying!
 
Upvote 0
thanks for the formula, I think this would work if the list was in sequential order. but the #'s are random (my fault, didn't think to mention that) I do appreciate you trying!

Woops, in my post I was using several different columns to perform different sections of the task, then combining them into 1 formula.
My preferred way to build complex formulas.

But I forgot to combine 1 part back into the single formula

I had this in C1
=FIND(" ",A1)

Then I posted this (which still included a reference to C1)
=TRIM(MID(SUBSTITUTE(A1,"(",REPT(" ",LEN(A1))),C1+1,LEN(A1)))


The formula should actually be
=TRIM(MID(SUBSTITUTE(A1,"(",REPT(" ",LEN(A1))),FIND(" ",A1)+1,LEN(A1)))


Anyway, regardless of that..Barry's solution is much better anyway...lol
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,752
Members
449,186
Latest member
HBryant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top