Extract 1st, 2nd, 3rd, 4th, etc value of a cell

Ananthak275

Board Regular
Joined
Aug 22, 2020
Messages
128
Office Version
  1. 2013
Platform
  1. Windows
  2. MacOS
I have a cell that have values combined together split by "-". Need to extract the 1st, 2nd, 3rd, 4th, etc value

Eg:

Name - Address - Details - ID - PlanBCDEF
AK - Ontario - Phone - 123123 - 50AKOntario Phone 12312350
GFD- Ontario - Phone - 754523- 234GFDOntario Phone 754523234
SDB- Quebec- Phone - 241- 79SDBQuebecPhone 24179
SDA- Ontario - Phone - 5123- 124SDAOntario Phone 5123124
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Upvote 0
Hi,

Try:

Book3.xlsx
ABCDEF
1Name - Address - Details - ID - Plan
2AK - Ontario - Phone - 123123 - 50AKOntarioPhone12312350
3GFD- Ontario - Phone - 754523- 234GFDOntarioPhone754523234
4SDB- Quebec- Phone - 241- 79SDBQuebecPhone24179
5SDA- Ontario - Phone - 5123- 124SDAOntarioPhone5123124
Sheet1048
Cell Formulas
RangeFormula
B2:F5B2=TRIM(MID(SUBSTITUTE($A2,"-",REPT(" ",100)),COLUMNS($B2:B2)*100-99,100))
Is there a way i can do individual values per column? eg: Column B get the 2nd value between "-". Column C, get the 3rd Value
 
Upvote 0
That's what it does.

B2 formula is copied down and across to F5

Results are Exactly as you wanted in your OP.
Unless, now you're saying to Skip the First value?
 
Upvote 0
That's what it does.

B2 formula is copied down and across to F5

Results are Exactly as you wanted in your OP.
Unless, now you're saying to Skip the First value?
Hi Sorry this is on me. A more accurate example would be seen below, where I have some columns where the value in Column A:

eg : Corleone Tres Matthew - Ontario Land Line Development - Phone Plans - No Variation - Change User to Another Land Line

Can you adjust your code to get the values with this as an example ^ ? thank you
 
Upvote 0
This modified version should do, B2 formula copied down and across as needed:

Book3.xlsx
ABCDEF
1Name - Address - Details - ID - Plan
2AK - Ontario - Phone - 123123 - 50AKOntarioPhone12312350
3GFD- Ontario - Phone - 754523- 234GFDOntarioPhone754523234
4SDB- Quebec- Phone - 241- 79SDBQuebecPhone24179
5SDA- Ontario - Phone - 5123- 124SDAOntarioPhone5123124
6Corleone Tres Matthew - Ontario Land Line Development - Phone Plans - No Variation - Change User to Another Land LineCorleone Tres MatthewOntario Land Line DevelopmentPhone PlansNo VariationChange User to Another Land Line
Sheet1048
Cell Formulas
RangeFormula
B2:F6B2=TRIM(MID(SUBSTITUTE($A2,"-",REPT(" ",LEN($A2))),COLUMNS($B2:B2)*LEN($A2)-LEN($A2)+1,LEN($A2)))
 
Upvote 0
Solution
Another option is to use the "text to columns" under the Data ribbon.
Choose Delimited option.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,313
Members
452,634
Latest member
cpostell

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