Pull Data From Two Tables

FiddleRox

New Member
Joined
Aug 30, 2015
Messages
4
I am attempting to match data (state and year) in two tables that have the same h row and v column headers by using 2 drop list
StateYearPopulationCases
Drop ListDrop ListResult From Table 1Result From Table 2

Both tables would look similar to the following:

Table 1 (Population)

STATE1960196119621963
AlabamaAAAAABBBBBCCCCCDDDDD
AlaskaEEEEEFFFFFGGGGGHHHHH
ArizonaIIIIIJJJJJKKKKKLLLLL


Table 2 (Cases)


STATE1960196119621963
AlabamaAAAAABBBBBCCCCCDDDDD
AlaskaEEEEEFFFFFGGGGGHHHHH
ArizonaIIIIIJJJJJKKKKKLLLLL


I need the 2 drop lists (State and Year) to pull data and match the desired cells (state and year) from each table into the corresponding cells (Population and cases). For example: Alaska and 1962 from both tables.

The code that I have in the cell "Result From Table 1" is - =VLOOKUP(B3,A12:CN62,HLOOKUP(C3,B10:CN11,2,FALSE),FALSE). That works the way it should.

The code that I have in cell "Result From Table 2" is - =VLOOKUP(B3,A79:CN129,HLOOKUP(C3,B77:CN77,2,FALSE),FALSE). This code give me the #REF! error.

How can I get my desired result in the cell "Result From Table 2"?

Please help. I thank you in advance.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi,

Instead of HLOOKUP you can try INDEX MATCH functions which are more robust.

Try the following in C2:
=INDEX($I$2:$M$5,MATCH($A2,$I$2:$I$5,0),MATCH($B2,$I$2:$M$2,0))

In D2: =INDEX($I$9:$M$12,MATCH($A2,$I$9:$I$12,0),MATCH($B2,$I$9:$M$9,0))


This is keeping in mind, you have the population table in I2:M5

Cases table in I9 to M12

the combined table is in A1:D2

PM your email address if you need the sample file that I created for you!
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

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