Hierarchical data combined into list for Google Sheets

hro5e

Board Regular
Joined
Jan 13, 2012
Messages
60
Good day.

I have a sheet of data, columns D:G

Column D is the "parent" of E, E is the parent of F and F is the parent of G.

example data below:
Column D
Column E
Column F
Column G
Bedroom 1BuildingInternal PartitionsFramework
Bedroom 1BuildingInternal PartitionsInsulation
Bedroom 2BuildingScreedSelf level
Bedroom 2DecorationPaintingUndercoat

Now I need a formula that will combine the data into a list:

the results should be as so: (each line is its own ROW)

Bedroom 1
> Building
>> Internal Partitions
>>> Framework
>>> Insulation
Bedroom 2
> Building
>> Screed
>>> Self level
> Decoration
>> Painting
>>> Undercoat

The ">" are just for explanation purposes.

Essentially the child data is grouped into the direct parent and so on.

This is my current formula which works fine for one parent and one child scenario. with a helper column

=ARRAYFORMULA(FLATTEN(IF('04'!A3:A = 1, '04'!D3:D, '04'!G3:G))).

Any assistance would be great
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
OK, so I used a pivot table, to format the data,

then used this formula to combine the data including blanks:
=ARRAYFORMULA(FLATTEN(IF(ROW('04-1'!A:A) <= MAX(ARRAYFORMULA(IF('04-1'!A:A<>"", ROW('04-1'!A:A)))), '04-1'!A:D, "")))

then in another column use this to get rid of the blanks:

=FILTER(E:E, E:E <> "")

neat work around, but a single formula would be useful (without using googlescript)
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,513
Members
449,456
Latest member
SammMcCandless

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