How to Group Spreadsheet Data by Column?

What is the best way to group spreadsheet data by column?
How to group lists of arbitrary length in Column C under their heading in Column B, and then group Column B (also arbitrary lengths) lists under heading in Column A?

The solution I came up with (attached below) was to find nulls within my lists and then split the lists based on those null locations. Then carefully merge my split lists into the final structure.

As you can see, my way took very many nodes and seems overly complicated. What is the more efficient way to accomplish this?

test.dyn (94.8 KB)

simple.xlsx (8.1 KB)

@Bren You can do something like this with Python to get the same result in 8 lines:

OUT = []
for row in IN[0]:
	if row[0] != None:
	elif row[1] != None:

Stunningly simple!

Seems like the answer is always python… Guess I should start learning it.

1 Like

That’s clever. :rofl:

1 Like

@Bren Yes, Python is a beast! I would definitely recommend learning it.

@Nick_Boyts Yeah, couldn’t think of anything better in that moment :rofl:

1 Like