How to dissect cell text at commas and spill the components with sorting and uniform spelling? :)

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
528
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have some cells that contain long comma-separated text like this in each cell:

Day0, Day 1,Day7, Day 15,Day30, Day 250,Day45, Day125

I want to make a formula that would dissect all components of the cell text (should be maximum 40) between commas and spill the resulting components horizontally. Additionally, it would be great to have the following features (as many as feasible 😅)

1) uniform spelling of all components with 1 space in between "Day" and the number
2) typos in "Day" automatically corrected in the output spill
3) skip the components with missing number (so that they don't appear in the spilled row)
4) sort the spilled results with increasing number

I was having a hard time coming up with the function, so thanks for any input! 🙃

Thanks for any input!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
With over 250 posts you should by now be getting the idea that one example is really insufficient as it does not demonstrate any variety that may occur in the data. Further, expected results are invaluable in clarifying what you are trying to achieve. Please consider both for future questions.

Based on my reading of your post,..

IF you do have the TEXTSPLIT function

22 08 07.xlsm
ABCDEFGHI
1Day0, Day 1,Day7, Day 15,Day30, Day 250,Day45, Day125Day 0Day 1Day 7Day 15Day 30Day 250Day 45Day 125
2yaD0, Day 1,Day7, Day 15,Dya,Day30, Day 250,Day45, Day125Day 0Day 1Day 7Day 15Day 30Day 250Day 45Day 125
Days
Cell Formulas
RangeFormula
B1:I2B1=LET(ch,MID(A1,SEQUENCE(LEN(A1)),1),TEXTSPLIT("Day "&SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(ch+0),ch," ")))," ",",Day "),","))
Dynamic array formulas.


IF you do not have TEXTSPLIT

22 08 07.xlsm
ABCDEFGHI
1Day0, Day 1,Day7, Day 15,Day30, Day 250,Day45, Day125Day 0Day 1Day 7Day 15Day 30Day 250Day 45Day 125
2yaD0, Day 1,Day7, Day 15,Dya,Day30, Day 250,Day45, Day125Day 0Day 1Day 7Day 15Day 30Day 250Day 45Day 125
Days2
Cell Formulas
RangeFormula
B1:I2B1=LET(ch,MID(A1,SEQUENCE(LEN(A1)),1),TRANSPOSE(FILTERXML("<p><c>Day "&SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(ch+0),ch," ")))," ","</c><c>Day ")&"</c></p>","//c")))
Dynamic array formulas.
 
Upvote 0
Solution
Thank you so much! This is exactly what I needed.

I will definitely provide more of both components that you mentioned in future. I've been trying to get my XL2BB to work again. Not sure what happened, but starting a few days ago, Excel blocks it every time I want to start it.
 
Upvote 0
Upvote 0
Thank you! I just tested on both my work and home computers, and interestingly, it happens only on my work computer. After selecting XL2BB from the add-on selection and clicking OK, I get the following two errors:

1) Excel ribbon saying: "SECURITY RISK Microsoft has blocked macros from running because the source of this file is untrusted"
2) error window saying: "Microsoft Office has identified a potential security concern. Microsoft has blocked macros from running because the source of this file is untrusted". And there is a "Disable Macros" button which I didn't try to click.

Perhaps it's an IT-implemented extra security check?
 
Upvote 0
Perhaps it's an IT-implemented extra security check?
It obviously is some security setting.
Are you allowed to run other macros?
Option B in the linked page looks like it could be a solution for you - provided IT allows you to have, and place items in, a 'Trusted Location'.
 
Upvote 0
Thanks. I haven't tried other file-based macros like XL2BB. (I've only tried the VBA-based macros which I get from here).

But I'll talk to them during the week to see what I can do, and I'll look into the trusted location that you mentioned. I'll update back.
 
Upvote 0
So I was finally assisted today by our IT, and they remotely set up a trusted location for my macros, and now I have full access to XL2BB again 🍻 . They said they implemented this extra security starting about a couple of weeks ago.
 
Upvote 0

Forum statistics

Threads
1,214,524
Messages
6,120,049
Members
448,940
Latest member
mdusw

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