Transfer data to multiple columns from one workbook to another using info from two columns

addiee12

New Member
Joined
Jan 12, 2021
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Hi there,

I'm tracking data for parliaments and would to like to take data from last year's excel sheet and populate new ones for 2021 that has slightly different rows, columns and ordering (so a copy/paste won't work). What the old and the new have in common is: country names and chamber names -- but data will differ for bicameral parliaments (both of which will have the same country name). So...to transfer data over...I'll need to take into account both the Country and Chamber columns. I think something like and INDEX & MATCH or XLOOKUP can work...but I feel like I can't wrap my head around it o_O! How do I get information from all of the columns after Country/chamber in the old file, into the correct columns in the new file and ensure that information is correct? In general -- I'd really like to learn how to get data from one excel sheet to another using common factors between them. Thanks in advance for help!

Move this (old tracking file)
Old tracking file.jpg



To here (new tracking file)
New tracking file.jpg
 

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
Hi,

Use below code in new file.

I have assumed that the column names are same in both file. Use ctrl + shift + enter after writing the formula.

Excel Formula:
=INDEX('[oldfile.xlsx]Sheet1'!$C$2:$D$6,MATCH(1,('[oldfile.xlsx]Sheet1'!$A$2:$A$6=$A2)*('oldfile.xlsx]Sheet1'!$B$2:$B$6=$B2),0),MATCH(C$1,'[oldfile.xlsx]Sheet1'!$C$1:$D$1,0))
 
Upvote 0
Thanks so much for trying to help. I'm using a Mac so have replaced ',' with ';' in the formula. I'm just getting error messages -- "#N/A" which I take to mean excel isn't finding the information it's meant. I don't know what to do!
 
Upvote 0
Thanks so much for trying to help. I'm using a Mac so have replaced ',' with ';' in the formula. I'm just getting error messages -- "#N/A" which I take to mean excel isn't finding the information it's meant. I don't know what to do!
Can I use XMATCH?
 
Upvote 0
Thanks so much for trying to help. I'm using a Mac so have replaced ',' with ';' in the formula. I'm just getting error messages -- "#N/A" which I take to mean excel isn't finding the information it's meant. I don't know what to do!
#NA means, data not found (either country or chamber).

To handle #NA, you can use IFNA formula. The formula will return Not Found in place of #NA.

Excel Formula:
=IFNA(INDEX('[oldfile.xlsx]Sheet4'!$C$2:$D$6,MATCH(1,('[oldfile.xlsx]Sheet4'!$A$2:$A$6=$A2)*('[oldfile.xlsx]Sheet4'!$B$2:$B$6=$B2),0),MATCH(C$1,'[oldfile.xlsx]Sheet4'!$C$1:$D$1,0)),"Not Found")

If you want to keep cell blank, if value is not available, please use below:

Excel Formula:
=IFNA(INDEX('[oldfile.xlsx]Sheet4'!$C$2:$D$6,MATCH(1,('[oldfile.xlsx]Sheet4'!$A$2:$A$6=$A2)*('[oldfile.xlsx]Sheet4'!$B$2:$B$6=$B2),0),MATCH(C$1,'[oldfile.xlsx]Sheet4'!$C$1:$D$1,0)),"")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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