May 15 2024 11:03 PM
I have data that is exported from an application that puts mutiple rows of data in a single cell. I need to extact those embedded rows from cell and put into their own rows!! Show me the way please...
May 16 2024 12:03 AM
@fploof Can you show an example of how it looks like? What Excel version are you using?
May 16 2024 06:57 AM
May 16 2024 07:20 AM
If those are line breaks in the cell (e.g Ctrl+J), then try this:
=LET(line_break, CHAR(10), TEXTSPLIT(A1, , line_break))
May 16 2024 07:26 AM
May 16 2024 08:23 AM
No need to apologize. Here's a sample workbook with the formula.
May 16 2024 10:12 AM - edited May 16 2024 11:55 AM
The fun starts when one has an entire array of such lists!
MAP really does need considerable improvement to deal with arrays of arrays.
Taking a single cell formula further
= LET(
line_break, CHAR(10),
sep, {",", ":"},
list, TEXTSPLIT(target, sep, line_break),
values, TAKE(WRAPROWS(TOCOL(list), 2), , -1),
header, {"Date", "Amount", "Description"},
VSTACK(header, WRAPROWS(values, 3))
)
The attached makes a start at using bisection to build an array of arrays but
1. I have used BYROW because I have yet to implement MAP
2. The helper function was not written for more than one row returned from a given step of BYROW.
I think it is all a bit fragile!
= BYROWλ(targetList, SPLITBOOKINGλ)
May 16 2024 10:54 AM
May 16 2024 12:19 PM - edited May 16 2024 01:21 PM
I have removed the file because it wasn't working correctly.
It is overly complex for any particular problem, but the idea is that for any Lambda helper function that returns the 'nested arrays are not supported' error message from a formula such as
= BYROW(array, Fnλ)
replacing it by
= BYROWλ(array, Fnλ)
should give the array of arrays. I copied the function to this workbook to see what happens when each row returns many rows to be stacked. The outturn is that I have some debugging to do! My preference would be for Microsoft to extend the Lambda helper functions to return arrays of arrays; that would be far more efficient in several ways!
p.s. I think the attached is now working correctly!
Please accept my apologies and ignore this. I was using your problem for testing and formula development purposes.
May 16 2024 02:53 PM
May 17 2024 09:52 AM
I am pleased it worked out for you! The manual pasting to Word and back (as suggested by @Patrick2788) is something I wouldn't have thought of. Once I had got over the challenge of "Is it even possible using Excel?", I would most likely have turned to PowerQuery and treated it as an ETL problem, but even that might be regarded as overkill for a one-off task.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
SplitRowsbyLineFeed = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Input data array", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Input data array")
in
SplitRowsbyLineFeed