I have a table in mysql like this:
+-------+--------+-------------+
| child | parent | data |
+-------+--------+-------------+
| 1 | 0 | house |
| 2 | 0 | car |
| 3 | 1 | door |
| 4 | 2 | door |
| 5 | 2 | windscreen |
| 11 | 5 | wiper |
+-------+--------+-------------+
I connected to mysql from excel 2007 according to this tutorial except that i created the dns in system dns not in user dns, that worked for me.
I have a little knowledge about formulas and i couldn't figure out how to obtain this tabular data:
house | door
house | wall
car | door
car | windscreen | wiper
Edit 1
The part with mysql is not a concern here. That mysql table could very well be an excel table.
Edit 2
Now I realize that it was not even necessary to say that there is a mysql table here just an excel table. But this may inspire/help somebody.
Edit 3
After some documentation i managed to solve the most important aspects of my problem
The range in sheet db:
child parent data
1 0 car
2 0 house
3 1 door
4 2 door
5 1 window
6 2 window
7 1 windscreen
8 7 wiper
9 4 color
10 2 color
I have a name db that refers to
=db!$A$2:OFFSET(db!$C$2,COUNTA(db!$C:$C)-2,0)
a name child
=db!$A$2:OFFSET(db!$A$2,COUNTA(db!$A:$A)-2,0)
In another sheet with the name construct I started from B2 and used the following formula:
=IFERROR(
IF(ISBLANK(B1),
LARGE(child,COUNTA($A$2:A$2)+1),
VLOOKUP(B1,db,2,0)
),".")
In a third sheet named output I started from A1 and used the formula:
=IFERROR(VLOOKUP(construct!B2,db,3,0),".")
Now the last challenged is to make the formulas from construct and output to auto expend when new entry are added to the main table, but i don't think is possible.
Edit 4
When importing from sql in db sheet there will be a table instead of range so the formulas will look a little different. Click anywhere in the table, click design tab and rename the table base, then in construct sheet from b2 start with this formula:
=IFERROR(
IF(ISBLANK(B1),
LARGE(INDIRECT("base[child]"),COUNTA($A$2:A$2)+1),
VLOOKUP(B1,base,2,0)
),".")