link two tables in excel

mattijsstu

New Member
Joined
Jun 8, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I already looke online for an anwser to my problem and did not find any. So i am not even sure any anwser/solution would exist.

I have two named tables:

[input]
Name parentageName child 1Name child 2Name child 3
Eric
45​
EllaJoe
Jan
38​
Ann
John
32​
JonasMattKate

[output]
ParentName child
EricElla
EricJoe
JanAnn
JohnJonas
JohnMatt
JohnKate


The excel is used as a template, so the table is empty at the start.
I want the table named 'output' to be automatically filled in according to the table named 'input'. Above i did this now manualy to show the idea. When i would delete the first row from the 'input' table, it should also update the 'output' table and delete the corresponding items (first 2 rows here).

It only creates a new row in the 'output' table for each child name filled in at the 'input' table.

Perhaps someone on this forum has an idea how to solve this problem, currently i'm at a loss.

Thanks!

greetings

Matt
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Pls check this formula if this is what you are looking for...
 

Attachments

  • 1654677052599.png
    1654677052599.png
    27.7 KB · Views: 3
Upvote 0
unpivot your data using Power Query also called Get and Transform Data and found on the Data Tab of the ribbon.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name parent", "age"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Value", "Child"}}),
    #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Attribute"})
in
    #"Removed Columns"

Book4
ABCDEFGHI
1Name parentageName child 1Name child 2Name child 3Name parentageChild
2Eric45EllaJoeEric45Ella
3Jan38AnnEric45Joe
4John32JonasMattKateJan38Ann
5John32Jonas
6John32Matt
7John32Kate
Sheet1
 
Upvote 0
Hi DHP,

All tables are empty upon start, so there is nothing in A10 for instance. And i think you took the data from the 'output' table and moved it to the 'input', i have the oposite problem. user fills in data in the 'input' table, this then causes the 'output' table to be filled in automatically.
 
Upvote 0
unpivot your data using Power Query also called Get and Transform Data and found on the Data Tab of the ribbon.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name parent", "age"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Value", "Child"}}),
    #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Attribute"})
in
    #"Removed Columns"

Book4
ABCDEFGHI
1Name parentageName child 1Name child 2Name child 3Name parentageChild
2Eric45EllaJoeEric45Ella
3Jan38AnnEric45Joe
4John32JonasMattKateJan38Ann
5John32Jonas
6John32Matt
7John32Kate
Sheet1
Thanks for the reply, i have never used power query. I will have to look into it a little bit :).
Does this make a table from scratch? Since i already have this 'output' table in another sheet but just empty (there are also some more columns in the 'output' table than the 'input' table and the other way arround, won't be a problem i assume?)

Thanks!
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
Thanks for the links, this is indeed a very powerfull tool for as far as i can see.
Right now, it works but it creats a new table on a new sheet. If i already have a table in my excel file called 'output' and it has the correct headers etc. Can i use this to fill this existing table, not finding a quick way. Right now i could append, but it's going to add new collumns, not fill in the already existing columns in the table.

thx
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,947
Members
449,095
Latest member
nmaske

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