I am trying to transform a hierarchy with 5 Levels into a Parent/Child table with 2 columns.
I need to do this with Excel formulas, not VBA script. Can I do this with Index and Match functions?
The Parent/Child Table should be dynamic and update automatically if Hierarchy changes.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | H I E R A R C H Y | ||||
| 2 | Universe | ||||
| 3 | North America | ||||
| 4 | USA | ||||
| 5 | California | ||||
| 6 | San Francisco | ||||
| 7 | Los Angeles | ||||
| 8 | Montana | ||||
| 9 | Mexico | ||||
| 10 | Canada | ||||
| 11 | Europe | ||||
| 12 | Italy | ||||
| 13 | Spain | ||||
| France |
I was able to populate the Children with the array formula below, i.e. North America in B2:
{=INDEX(A3:E3,MATCH(FALSE,ISBLANK(A3:E3),0))}
However I am looking for a formula to populate the Parents.
Expected Parent / Child Table:
| A | B | |
|---|---|---|
| 1 | Parent | Child |
| 2 | Universe | North America |
| 3 | North America | USA |
| 4 | USA | California |
| 5 | California | San Francisco |
| 6 | California | Los Angeles |
| 7 | USA | Montana |
| 8 | North America | Mexico |
| 9 | North America | Canada |
| 10 | Universe | Europe |
| 11 | Europe | Italy |
| 12 | Europe | Spain |
| 13 | Europe | France |


