Forum Discussion
Kendethar
Aug 18, 2022Iron Contributor
SOLVED - Split data in dynamic/spill array by delimiter
Greetings everyone,
I have a calculation tool for Minecraft items that lists data from minecraft.fandom.com/wiki/Crafting and does various things with that data. I cannot get the queried data to spill properly because I don't know how.
I have a query to minecraft.fandom.com/wiki/Crafting/Bulding_blocks (to name one) that excludes the "Crafting recipe" column and the "Description column" (in Power Query Editor), on a sheet called Crafting & Ingredients Query. The data's listings sometimes show a choice of materials in the game by using an " or ". The cells display this with character 10 from the website.
I need a spill formula to separate and then continue the spill down for each occurrence of the " or ". I also need to show the same "Ingredient" on the right of those separations.
On a test sheet in range $B$4, I have a spill formula that simply references and filters the blanks of the Name column from the query on the Crafting & Ingredients Query sheet ('Crafting & Ingredients Query'!$B$5:$B$2000). In in range $D$4 of the test sheet, I am attempting to make a spill formula that will 1), remove all instances of " or " (CHAR(160)&"or"&CHAR(10)) then 2), display each item after the cell's delimiter ("or") sequentially underneath in the spill, and then 3) display the same Ingredient next to each item of the items that are transposed down.
Spill Formula so far (separates each item by the delimiter of Character 160, up to 10 delimiters for now):
Current Formula (spill from range $D$4 - incomplete)
=MID(SUBSTITUTE($B4:$B2000,CHAR(160),REPT(" ",LEN($B4:$B2000))),(TRANSPOSE(SEQUENCE(10,1)-1))*LEN($B4:$B2000)+1,LEN($B4:$B2000))
(Original formula credit: https://exceljet.net/formula/split-text-with-delimiter)
Notes:
• The =SEQUENCE() function is not dynamic (is just 10) and is temporary. Once each cell that has a delimiter is displayed underneath, the spill should be only 1 column wide.
• I want the number of delimiters a cell can have to be dynamic (no limit - infinite, 1 or 7 or 100 or whatever).
• Attached is the file with the relevant data.
I would be very grateful for any solution to make this spill formula happen. Thank you!
Perhaps you mean something like
=TEXTSPLIT( SUBSTITUTE( TEXTJOIN("@",1, B4# ), CHAR(160)&"or", "@" ), , "@" )
- KendetharIron ContributorWould MAKEARRAY be useful here, anyone?
- KendetharIron Contributor
Thanks for the reply! XML is foreign to me so I have no idea how that formula works but it is surely a cleaner approach. Two things now to figure out and I can make it perfect.
1) May you make that spill?
2) Can you move everything else down from the split?
It doesn't matter what order they're in but I was thinking of maybe having a spill range of everything that doesn't have a delimiter and a spill range of everything that does (then I'll use =LET() to combine them later)?
- Harun24HRBronze ContributorThat is possible if you have access to TEXTSPLIT() function. TEXTSPLIT() is only available to office insiders (BETA CHANNEL).