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 guide, except that I created the DSN in the system DSN, and not in the user DSN that worked for me.
I have a little knowledge of formulas and I could not figure out how to get this tabular data:
house | door house | wall car | door car | windscreen | wiper
The MySQL part doesn't matter here. This MySQL table may very well be an Excel table. Now I understand that it was not even necessary to say that there is a MySQL table, but just an Excel table. But it can inspire / help someone.
After some documentation, I managed to solve the most important aspects of my problem. Range in db sheet:
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 DB name that refers to:
=db!$A$2:OFFSET(db!$C$2,COUNTA(db!$C:$C)-2,0)
baby name:
=db!$A$2:OFFSET(db!$A$2,COUNTA(db!$A:$A)-2,0)
On another sheet with the name of the construction, I started with B2 and used the following formula:
=IFERROR( IF(ISBLANK(B1), LARGE(child,COUNTA($A$2:A$2)+1), VLOOKUP(B1,db,2,0) ),".")
On the third sheet, called output, I started with A1 and used the formula:
=IFERROR(VLOOKUP(construct!B2,db,3,0),".")
Now the last challenge is to create formulas from the design and output for automatic spending when adding new records to the main table, but I think this is not possible.
When importing from SQL, there will be a table instead of a range in the database sheet, so the formulas will look a little different. Click anywhere in the table, go to the Design tab and rename the base of the table, then in the construction 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) ),".")