Comparing two values and adding subsequent columns

microsoft excel

I am having two sheets and need to compare two columns, A and X such that if the values match then the value in front of the cell in column A, i.e column B is returned.

 Column A    Column B                        Column X        Column Y
 123            50                              456          100 
 456          100                               334

How can I accomplish this?

Best Answer

VLOOKUP is what you are looking for.

In column Y2: =VLOOKUP(X2;A1:B3;2;FALSE)

Using VLOOKUP you can find values in a table or matrix. Using it is quite simple:

=VLOOKUP(*lookupvalue*;*MATRIX*;*columnindex*;*rangelookup*)

The columnindex is based on your matrix.

Example: If your matrix is G1:J20, G* would have the columnindex 1, H* 2, I* 3, J* 4.

Range Lookup: TRUE assumes the first column in the table is sorted either numerically or alphabetically, and will then search for the closest value. This is the default method if you don't specify one.

FALSE is looking for the exact match.

More information can be found here

I've created you an example. Please note that I'm using a german excel client - therefore my formula isn't VLOOKUP, it is "sverweis"...

https://drive.google.com/open?id=0BxW3WdSITmbjTEw1bm1Gb2l1eWc

Related Question