Combining data from multiple worksheets

gwong

New Member
Joined
Mar 14, 2013
Messages
1
Hi,

I was wondering if I could get some help on how to combine data from multiple worksheets. Here is an example of what I am trying to accomplish:

Worksheet1 contains the following data:
[TABLE="width: 128"]
<colgroup><col style="width:48pt" span="2" width="64"> </colgroup><tbody>[TR]
[TD="width: 64"]Name[/TD]
[TD="width: 64"]Colour[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]Kevin[/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Anne[/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]Jen[/TD]
[TD]Pink[/TD]
[/TR]
</tbody>[/TABLE]


Worksheet2:
[TABLE="width: 128"]
<colgroup><col style="width:48pt" span="2" width="64"> </colgroup><tbody>[TR]
[TD="width: 64"]Name[/TD]
[TD="width: 64"]Fruit[/TD]
[/TR]
[TR]
[TD]Jack[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Kevin[/TD]
[TD]Banana[/TD]
[/TR]
[TR]
[TD]Anne[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Richard[/TD]
[TD]Orange[/TD]
[/TR]
[TR]
[TD]Christine[/TD]
[TD]Kiwi[/TD]
[/TR]
[TR]
[TD]Jen[/TD]
[TD]Orange[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Grapes[/TD]
[/TR]
</tbody>[/TABLE]


I would like to grab the fruit data from Worksheet2 and add it to a new column in Worksheet1 for only the names specified in Worksheet1. Basically the logic I am trying to get at is, search through the Name column in Worksheet2 for the same names as in Worksheet1, then add the corresponding fruit values to Worksheet1. What kind of formula could I use for this?

Correct output should be:
[TABLE="width: 192"]
<colgroup><col style="width:48pt" span="3" width="64"> </colgroup><tbody>[TR]
[TD="width: 64"]Name[/TD]
[TD="width: 64"]Colour[/TD]
[TD="width: 64"]Fruit[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Blue[/TD]
[TD]Grapes[/TD]
[/TR]
[TR]
[TD]Kevin[/TD]
[TD]Green[/TD]
[TD]Banana[/TD]
[/TR]
[TR]
[TD]Anne[/TD]
[TD]Red[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Jen[/TD]
[TD]Pink[/TD]
[TD]Orange[/TD]
[/TR]
</tbody>[/TABLE]


This is of course an extremely simplified example, the real data that I am using contains thousands of lines, but the idea is still the same. So my question is, what formula could I use for column C in Worksheet1 that can compare the name values in Worksheet1 with the name values in Worksheet2, and if they are the same, grab the fruit value corresponding to that name and add it to the column C? Any help would be greatly appreciated it.

Thank you,
Gavin
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
If your values a unique...

Sheet1

*ABC
NameColourFruit
JohnBlueGrapes
KevinGreenBanana
AnneRedApple
JenPinkOrange

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
C2=VLOOKUP(A2,Sheet2!$A$2:$B$8,2,FALSE)

<tbody>
</tbody>

<tbody>
</tbody>


Sheet2

*AB
NameFruit
JackApple
KevinBanana
AnneApple
RichardOrange
ChristineKiwi
JenOrange
JohnGrapes

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

[TD="bgcolor: #cacaca, align: center"]6[/TD]

[TD="bgcolor: #cacaca, align: center"]7[/TD]

[TD="bgcolor: #cacaca, align: center"]8[/TD]

</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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