Excel - Combining values using IF/Then search

December 2016



Issue


I am trying to combine two worksheets that have some similar data points but not all.
Example:
  • Sheet 1 has columns: Name, Age, Class
  • Sheet 2 has columns: Name, DOB


Note that: There may be >1 rows in Sheet 1 but only 1 row sheet 2 with the same Name (aka: multiple classes for same Name, but only 1 DOB entry)
I am looking for a way to combine all the values from sheet 1 and sheet 2 together so each row in sheet 1 has all the data on it.

Basically I'm looking for a way to parse through column A on sheet 2 and if there is a match, copy the value from Column B on sheet 2 to Column D on Sheet1.

Solution


REMEMBER the sheet 1 and 2 are interconnected regarding age and DOB.

sample data sheet1 

Name	 Age	 Class 
a	7	2 
s	6	1 
d	10	3 
f	5	1 
d	10	3 
s	6	1 
a	7	2 
w	8	3 
r	9	6 
t	10	8 


sheet 2 

name	dob 
a	12-Oct-04 
s	8-May-05 
d	12-Jul-01 
f	11-Jun-06 

in sheet1 D2 copy this formula 
=VLOOKUP(A2,Sheet2!$A$1:$B$5,2,0) 
copy D2 down 

Related :

This document entitled « Excel - Combining values using IF/Then search  » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.