dynamically split cell into separate cells

Danny54

Active Member
Joined
Jul 3, 2019
Messages
295
Office Version
  1. 365
Platform
  1. Windows
I'm looking for a way to split comma delimited data (Tags) into separate cells.
new sheet shows the data from Tags being split by the comma and inserted into a new cell by itself having the data aligned for that row.


it would be great if headers were inserted for the cols inserted as shown in new sheet 1

Thanks

Date1Date2Date3value%OwnerInstallercolorlocalzipzonecitysysTagsNotesIDExDOWImCID
2022-08-23T05:39:20Z2021-05-27T00:49:25Z2022-08-23T05:12:36Z010JohnJohnnoflorida,kansas,new york,texas60054
2022-08-17T05:43:43Z2021-07-14T10:54:56Z2022-08-17T04:17:17Z28010JoeJoenoohio,kansas,texas87540

new sheet
Date1Date2Date3value%OwnerInstallercolorlocalzipzonecitysysTagsNotesIDExDOWImCID
2022-08-23T05:39:20Z2021-05-27T00:49:25Z2022-08-23T05:12:36Z010JohnJohnnoflorida,kansas,new york,texas60054floridakansasnew yorktexas
2022-08-17T05:43:43Z2021-07-14T10:54:56Z2022-08-17T04:17:17Z28010JoeJoenoohio,kansas,texas87540kansasohiotexas

new sheet 1
Date1Date2Date3value%OwnerInstallercolorlocalzipzonecitysysTagsNotesIDExDOWImCIDfloridakansasnew yorkohiotexas
2022-08-23T05:39:20Z2021-05-27T00:49:25Z2022-08-23T05:12:36Z010JohnJohnnoflorida,kansas,new york,texas60054floridakansasnew yorktexas
2022-08-17T05:43:43Z2021-07-14T10:54:56Z2022-08-17T04:17:17Z28010JoeJoenoohio,kansas,texas87540kansasohiotexas
 
Both textjoin & filterxml have a limit of ~32,700 characters, so you are possibly hitting that limit, but I wouldn't have thought so unless you have long strings in those cells.
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
TEXTJOIN documtation says that you can only have 252 text elements, and only 32k characters.
 
Upvote 0
If you just put
Excel Formula:
=TEXTJOIN(",",TRUE,A2:A150)
into a cell do you get the #value error?
 
Upvote 0
Thanks Fluff / James

That was my original value used this morning when it stopped with the error at row 64.
I think James may have hit it, there is a max amount of rows that can be read in using the TEXTJOIN function
At line 64 we have 111 different splits with a average length of text between the comma separated value is 55.

Any other suggesting on resolving this task?

Perhaps using Power Query...
 
Upvote 0
there is a max amount of rows that can be read in using the TEXTJOIN function
That is not true, the number of rows is unlimited, just the number of characters. Can you answer my question in post#13?
 
Upvote 0
Sorry,
Yes, I get a value error

Thanks

1661788678655.png
 
Upvote 0
In that case the string is too long, do you have the HSTACK function yet?
 
Upvote 0
If you type =Hs into a cell do you get the HSTACK option, it's a very new function & not everyone has it yet.
 
Upvote 0
If you do have HSTACK use the formula in D2, otherwise use the one in D3
Fluff.xlsm
ABCDEFGHIJKLMNO
1
2Hollingdean,and,StanmerHollingdeanandStanmerBurwellBramleyStanningleyCupernhamCotonLeaBridgeHertfordCastle
3BurwellHollingdeanandStanmerBurwellBramleyStanningleyCupernhamCotonLeaBridgeHertfordCastle
4Bramley,and,Stanningley
5Cupernham
6Coton
7Lea,Bridge
8Hertford,Castle
9
Report
Cell Formulas
RangeFormula
D2:O2D2=DROP(REDUCE("",A2:A8,LAMBDA(a,b,UNIQUE(HSTACK(a,TEXTSPLIT(b,",")),1))),,1)
D3:O3D3=REDUCE(LEFT(A2,FIND(",",A2)-1),A2:A8,LAMBDA(a,b,LET(c,COLUMNS(a),z,TRANSPOSE(FILTERXML("<k><m>"&SUBSTITUTE(b,",","</m><m>")&"</m></k>","//m")),s,SEQUENCE(,c+COLUMNS(z)),UNIQUE(IF(s<=c,a,INDEX(z,,s-c)),1))))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,109
Members
452,302
Latest member
TaMere

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