Extract values from one cell into many cells

JohnZ1156

Board Regular
Joined
Apr 10, 2021
Messages
180
Office Version
  1. 2021
Platform
  1. Windows
I have a series of numbers separated by " - ".
I'd like formulas to extrtact each number to separate cells.

EXAMPLE:
1723809210433.png
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You could do a Find/Replace, replacing all spaces with nothing to first get rid of all your spaces.
Then you could select that column, go to the Data menu, select Text to Columns, choose the "Delimited" option, enter a dash in the "Other" option under Delimiters, and click Finish.

This will split that one column into multiple columns.
 
Upvote 0
You could use
Excel Formula:
=VALUE(TEXTSPLIT(B2," - "))
in C2 and copy it down
 
Upvote 0
I would go with text to columns, but a formula for 2021
Excel Formula:
=LET(a,"-"&B2&"-",s,SEQUENCE(,LEN(a)-LEN(SUBSTITUTE(a,"-",""))-1),--REPLACE(LEFT(a,FIND("^",SUBSTITUTE(a,"-","^",s+1))-1),1,FIND("^",SUBSTITUTE(a,"-","^",s)),""))
 
Upvote 1
Solution
If you want to do it by formula you could use this:

Book1
ABCDEFG
1
234 - 55 - 59 - 65 - 703455596570
312 - 32 -38 - 40 - 571232384057
423-29-38-61-702329386170
5 6 - 7 - 24 - 44 - 5467244454
Sheet3
Cell Formulas
RangeFormula
C2:G5C2=LET(t, "-"&B2&"-", s, SEQUENCE(,5), dt, SUBSTITUTE(SUBSTITUTE(t, "-","s", s), "-", "e", s), start, FIND("s", dt), end, FIND("e", dt), VALUE(MID(dt, start+1, end-start-1)) )
Dynamic array formulas.
 
Upvote 0
You could use
Excel Formula:
=VALUE(TEXTSPLIT(B2," - "))
in C2 and copy it down
According to Microsoft, the TEXTSPLIT function is not available in Excel 2021, which is the version they are shown as using.
So if that is indeed the case, they probably do not have this function at their disposal.
 
Upvote 0
You can try this for formula option:
Edit: Disregard TEXTAFTER and TEXTBEFORE not available in 2021.
Book1
BCDEFG
1FirstSecondThirdFourthFifth
22 - 14 - 65 - 53 - 25214655325
334 - 32 - 38 - 40 - 573432384057
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=--TEXTBEFORE(B2," - ")
D2:D3D2=--TEXTAFTER(TEXTBEFORE($B2 & " - "," - ",2),C2 & " - ")
E2:E3E2=--TEXTAFTER(TEXTBEFORE($B2 & " - "," - ",3),D2 & " - ")
F2:F3F2=--TEXTAFTER(TEXTBEFORE($B2 & " - "," - ",4),E2 & " - ")
G2:G3G2=--TEXTAFTER(TEXTBEFORE($B2 & " - "," - ",5),F2 & " - ")
 
Upvote 0
According to Microsoft, the TEXTSPLIT function is not available in Excel 2021, which is the version they are shown as using.
So if that is indeed the case, they probably do not have this function at their disposal.
Thanks @Joe4 - I do wish there was a little consistency.
 
Upvote 0
Another option
Excel Formula:
=TRANSPOSE(FILTERXML("<k><m>"&SUBSTITUTE(B2,"-","</m><m>")&"</m></k>","//m"))
 
Upvote 0
And another way using Rick's method from way back in 2012.

Book2
ABCDEFG
1FirstSecondThirdFourthFifth
22 - 14 - 65 - 53 - 25214655325
334 - 32 - 38 - 40 - 573432384057
Sheet1
Cell Formulas
RangeFormula
C2:G3C2=0+MID(SUBSTITUTE(B2," - ",REPT(" ",99)),{1,2,3,4,5}*99-98,99)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,222,725
Messages
6,167,859
Members
452,150
Latest member
jenningstrades

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