Extract text between commas

thanksamillion101

New Member
Joined
Jul 8, 2020
Messages
41
Office Version
  1. 2010
Good evening,
I am needing to extract text, using the end of the string and moving left. The information before the last two commas will always be the same . The information before the third to last comma, will not always be the same. Thank you in advance for your help!!!

The formula I need will extract and return in 3 different columns: Physical location in the first column and City in the the second column and ST in the third column.

String:
[Company Name], Physical Location, City, ST 99901, USA

1643348529956.png


A couple of the formulas I have tried.

MID(SUBSTITUTE(A2," ",""), FIND("USA",SUBSTITUTE(A2," ",""))-8,7)

TRIM(LEFT(RIGHT(SUBSTITUTE(A2,",",REPT(" ",100)),200),100))
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Like this?

22 01 28.xlsm
ABCDE
1
2Co name, Physical Location, City, ST 99901, USAPhysical LocationCityST 99901
Extract Text
Cell Formulas
RangeFormula
C2:E2C2=TRIM(LEFT(RIGHT(SUBSTITUTE($A2,",",REPT(" ",100)),500-100*COLUMNS($C:C)),100))
 
Upvote 0
Solution
Or for column E perhaps you want this?

22 01 28.xlsm
ABCDE
1
2Co name, Physical Location, City, ST 99901, USAPhysical LocationCityST
Extract Text (2)
Cell Formulas
RangeFormula
C2:D2C2=TRIM(LEFT(RIGHT(SUBSTITUTE($A2,",",REPT(" ",100)),500-100*COLUMNS($C:C)),100))
E2E2=TRIM(LEFT(RIGHT(SUBSTITUTE($A2," ",REPT(" ",100)),300),100))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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