Ask a question »

Excel - Compare from one column to another

May 2015


Excel - Compare from one column to another



Issue


I am working with Excel 2003. I need the formula to look in Column 1 and look at all these names. And compares the name if it is Sally the add Tom in column next to it (this is who she reports to), if first column second row is Mary and automatically add Julie on the same row she is but this specific column.

Example:
Name of employee Reports to  
Sally Tom  
Mary Julie  
Bob Julie  
John Tom 


So, it looks at NameofEmployee column and it matches if it is `this' name then the manager is this and adds that name in the specific column.

Solution


Suppose in your sheet1 you have data of Employee Name & Manager of employee in column A & B

A B  
emp Manager  
Sally Tom  
Mary Julie  
Bob Julie  
John Tom 


Now in your sheet 2 you have only names in Column A
A  
emp name  
Sally  
Mary  
Bob  
John 


Now in cell B2 of sheet2 write this formula and drag it down ...

=INDEX(Sheet1!B:B,(MATCH(Sheet2!A2,Sheet1!A:A,0))) 

Note


Thanks to mubashir aziz for this tip on the forum.
For unlimited offline reading, you can download this article for free in PDF format:
Excel-compare-from-one-column-to-another.pdf

See also

In the same category

Published by aakai1056. - Latest update by Jeff
This document entitled « Excel - Compare from one column to another » from Kioskea (en.kioskea.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.