Populating Field in Table1 Cell Based on Certain Table1 Cells matching Table2 Cells

jimdegeorge

New Member
Joined
May 13, 2010
Messages
7
Hi

I have two tables (Table1 and Table2) on 2 different tabs (Sheet1 and Sheet2, respectively).

Table1
[TABLE="width: 285"]
<tbody>[TR]
[TD]Name[/TD]
[TD]City[/TD]
[TD]Line[/TD]
[TD]District[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Boston[/TD]
[TD]Hard Goods[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Los Angeles[/TD]
[TD]Soft Goods[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]William[/TD]
[TD]Baltimore[/TD]
[TD]Soft Goods[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Harold[/TD]
[TD]Miami[/TD]
[TD]Hard Goods[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Table2
[TABLE="width: 220"]
<tbody>[TR]
[TD]Name[/TD]
[TD]City[/TD]
[TD]District[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Boston[/TD]
[TD]North East[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Los Angeles[/TD]
[TD]West[/TD]
[/TR]
[TR]
[TD]William[/TD]
[TD]Baltimore[/TD]
[TD]Central East[/TD]
[/TR]
[TR]
[TD]Harold[/TD]
[TD]Miami[/TD]
[TD]South East[/TD]
[/TR]
</tbody>[/TABLE]

When NAME and CITY from Table1 are found on Table2, I want to save Table2's DISTRICT value in the appropriate Table1 DISTRICT cell.


This is the desired Table1 result:
[TABLE="width: 285"]
<tbody>[TR]
[TD]Name[/TD]
[TD]City[/TD]
[TD]Line[/TD]
[TD]District[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Boston[/TD]
[TD]Hard Goods[/TD]
[TD]North East[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Los Angeles[/TD]
[TD]Soft Goods[/TD]
[TD]West[/TD]
[/TR]
[TR]
[TD]William[/TD]
[TD]Baltimore[/TD]
[TD]Soft Goods[/TD]
[TD]Central[/TD]
[/TR]
[TR]
[TD]Harold[/TD]
[TD]Miami[/TD]
[TD]Hard Goods[/TD]
[TD]South East[/TD]
[/TR]
</tbody>[/TABLE]


I've tried these formulas in Table1 DISTRICT...

=IF(Table1[@[Name]:[City]]=Table2[@[Name]:[City]],Table2[@District],""), but this returns #VALUE !

=If(VLOOKUP(Table1[@[Name]:[City]],Table2[[Name]:[City]],C,FALSE),Table2[@District],""), but I can't get it formatted correctly.


I'd really appreciate any help!
Thanks!
Jim
 

Excel Facts

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

What about a concatenation of the Name & City fields and then use that for INDEX/MATCH or VLOOKUP?

Or an UPDATE query, using
Code:
UPDATE Table1 T1 INNER JOIN Table2 T2 ON T1.Name = T2.Name AND T1.City = T2.City
SET T1.District = T2.District

regards
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,111
Members
452,302
Latest member
TaMere

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