VLOOKUP & INDEX + MATCH

Excel Tip #012

VLOOKUP & INDEX + MATCH

Excel has many formulas which functions differently. To analyze data, one of the most important formula is VLOOKUP and INDEX + MATCH. Let us now get into the details of it.

VLOOKUP:

Let us consider the below data as an example.
Sales Data
Let us say, we want to know how much sales did Jerald make? VLOOKUP can be used to answer this question.

What does VLOOKUP actually do?
     VLOOKUP searches a list for a value in left most column and returns corresponding value from adjacent columns.

Syntax: =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
In simple terms,
= VLOOKUP(value/data that is used as reference, data table, the column # where our resultant data resides, exact (or) approximate match)

The final parameter is optional but very important. In the next tutorial, I will provide a few examples explaining how to correctly make formulas for exact (or) approximate match for VLOOKUP.

In our example of finding the sales of Jerald, we need VLOOKUP to search for Jerald (cell A6) and return the amount of sales he made from column 3.

The formula will be:
     =VLOOKUP(A6,$A$2:$C$11,3,FALSE)

VLOOKUP to get sales data for Jerald
To fetch the units sold by a person, the column # should be 2.

Some more examples:
Few more examples on VLOOKUP
You can notice that the 3rd question is left unanswered. This is because of a drawback of VLOOKUP, it cannot lookup values in the left.

To overcome this, we have to make use of the combination INDEX & MATCH in the next part.

INDEX + MATCH:

VLOOKUP can only return corresponding items from the column at right, not at left. One easy fix would be move the sales data to the left of sales rep. But this is an annoying and later you may want to lookup based on unit values too. So let us see can INDEX & MATCH can handle this scenario.

Below are the syntax of INDEX & MATCH.
     =INDEX(reference, row_num, [column_num])
     =MATCH(lookup_value, lookup_array, [match_type])

The basic syntax of this combination is like this
    =INDEX(column with data you want,MATCH(value you are looking for, column which contains this data,0)

Our problem is to find out the sales rep who made sales = $470. Sales rep names are in column A and the value $470 is in cell C8. The formula will be,

     =INDEX($A$2:$A$11,MATCH(C8,$C$2:$C$11,0))

INDEX + MATCH to get the sales rep name who made sales $470
Some more examples:

INDEX + MATCH can also work like VLOOKUP, meaning INDEX + MATCH combination is not only used to lookup values in the left but also towards right. Look at question 3 in the below example
Few more examples on INDEX + MATCH

Comments

Popular posts from this blog

VLOOKUP - Exact Match & Approximate Match

Row 1 Is Missing. How to unhide?

Search Backwards in Excel