Text To Columns with odd items in brackets

mad3

Board Regular
Joined
Sep 15, 2009
Messages
128
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have two columns with 9 or more single digits numbers that are text. The issue with simple text to columns is that if any of the 9 numbers is a double digit number it looks like this in the cell...

Q​
R​
0001010(11)0400100000
0000001000000000200
101010100000000(10)000


I want to extract each individual number in column Q to separate columns; same with column R. to a separate column to study the totals, but have an issue every time it runs into the odd ball double digit number which is always like this (10)

If it helps, these are line scores from baseball games, but have a number of them with double digit scoring in a single inning.
any ideas on how to extract each number including the double digit numbers?

Thanks, Mike in Cali...
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Update your profile showing the version of Excel you are using so we know what functions we can use to design a formula for you.
 
Upvote 0
Update your profile showing the version of Excel you are using so we know what functions we can use to design a formula for you.
I use Excel 365 for both Mac and PC. My primary computer is PC due to Excel having more options. How do I update profile to show version?
 
Upvote 0
Does this do what you want for column Q?

23 12 02.xlsm
QSTUVWXYZAAABACAD
10001010(11)00001010110
20000001002000000010020
3(10)9(11)(12)00000109111200000
425610(12)(11)6(10)256101211610
5(10)(10)(10)(10)(10)(10)(10)(10)(10)(10)10101010101010101010
To Columns
Cell Formulas
RangeFormula
S1:AA1,S5:AB5,S3:AA4,S2:AC2S1=LET(ts,TEXTSPLIT(Q1,{"(",")"}),TEXTSPLIT(TEXTJOIN(" ",1,BYCOL(TEXT(SEQUENCE(,COLUMNS(ts)),"00")&ts,LAMBDA(c,IF(ISODD(LEFT(c,2)+0),TEXTJOIN(" ",1,MID(c,SEQUENCE(,99,3),1)),MID(c,3,2)))))," "))
Dynamic array formulas.
 
Upvote 0
Another option where TEXT in combination with REPT is key

Book1
ABCDEFGHIJKL
10001010(11)00001010110
20000001002000000010020
3(10)9(11)(12)00000109111200000
425610(12)(11)6(10)256101211610
5(10)(10)(10)(10)(10)(10)(10)(10)(10)(10)10101010101010101010
Sheet1
Cell Formulas
RangeFormula
B1:J1,B5:K5,B3:J4,B2:L2B1=DROP(REDUCE("",TEXTSPLIT(A1,{"(";")"},,1),LAMBDA(a,b,HSTACK(a,IF(LEN(b)=2,b,DROP(TEXTSPLIT(TEXT(b,REPT("0 ",LEN(b)))," "),,-1))))),,1)
Dynamic array formulas.
 
Last edited:
Upvote 0
Another option where TEXT in combination with REPT is key

Book1
ABCDEFGHIJKL
10001010(11)00001010110
20000001002000000010020
3(10)9(11)(12)00000109111200000
425610(12)(11)6(10)256101211610
5(10)(10)(10)(10)(10)(10)(10)(10)(10)(10)10101010101010101010
Sheet1
Cell Formulas
RangeFormula
B1:J1,B5:K5,B3:J4,B2:L2B1=DROP(REDUCE("",TEXTSPLIT(A1,{"(";")"},,1),LAMBDA(a,b,HSTACK(a,IF(LEN(b)=2,b,DROP(TEXTSPLIT(TEXT(b,REPT("0 ",LEN(b)))," "),,-1))))),,1)
Dynamic array formulas.

Both options worked perfectly! Awesome. This also worked for linescores that had more than 9 innings.
 
Upvote 0
Does this do what you want for column Q?

23 12 02.xlsm
QSTUVWXYZAAABACAD
10001010(11)00001010110
20000001002000000010020
3(10)9(11)(12)00000109111200000
425610(12)(11)6(10)256101211610
5(10)(10)(10)(10)(10)(10)(10)(10)(10)(10)10101010101010101010
To Columns
Cell Formulas
RangeFormula
S1:AA1,S5:AB5,S3:AA4,S2:AC2S1=LET(ts,TEXTSPLIT(Q1,{"(",")"}),TEXTSPLIT(TEXTJOIN(" ",1,BYCOL(TEXT(SEQUENCE(,COLUMNS(ts)),"00")&ts,LAMBDA(c,IF(ISODD(LEFT(c,2)+0),TEXTJOIN(" ",1,MID(c,SEQUENCE(,99,3),1)),MID(c,3,2)))))," "))
Dynamic array formulas.
This worked perfectly!
 
Upvote 0
Update your profile showing the version of Excel you are using so we know what functions we can use to design a formula for you.
I use Excel 365 for both Mac and PC. My primary computer is PC due to Excel having more options. How do I update profile to show version?
Thank you for enlightening me on changing my profile so the gurus can know what to use for formulas. Eye opening. Since I use both Mac and PC, I should have known because the MAC is limited, at times, with Excel formulas when it comes to the advanced stuff.
 
Upvote 0
This also worked for linescores that had more than 9 innings.
As does the other one as you can see from rows 2 and 5 of the sample mini sheet. ;)
Anyway you have choice. :) (edit: perhaps not - see next post)

BTW, thanks for updating your profile. (y)
 
Last edited:
Upvote 0
Both options worked perfectly!
Actually, checking again, are you sure?
What about this example?

23 12 02.xlsm
ABCDEFGHIJQSTUVWXYZAAAB
1Using post 5 formulaUsing post 4 formula
211(10)22(11)11(10)11102211111011(10)22(11)11(10)111022111110
To Columns (3)
Cell Formulas
RangeFormula
B2:G2B2=DROP(REDUCE("",TEXTSPLIT(A2,{"(";")"},,1),LAMBDA(a,b,HSTACK(a,IF(LEN(b)=2,b,DROP(TEXTSPLIT(TEXT(b,REPT("0 ",LEN(b)))," "),,-1))))),,1)
S2:AA2S2=LET(ts,TEXTSPLIT(Q2,{"(",")"}),TEXTSPLIT(TEXTJOIN(" ",1,BYCOL(TEXT(SEQUENCE(,COLUMNS(ts)),"00")&ts,LAMBDA(c,IF(ISODD(LEFT(c,2)+0),TEXTJOIN(" ",1,MID(c,SEQUENCE(,99,3),1)),MID(c,3,2)))))," "))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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