Post image for Excel VLOOKUP – Sorted List Explained

Excel VLOOKUP – Sorted List Explained

by on September 22, 2010

in Excel,Microsoft Office Training,Online Training

In my previous Excel VLOOKUP tutorial I told you that there are two ways you can use a VLOOKUP but most people know one way or the other, and only a few know both.

If you haven’t read the first article in the VLOOKUP series then read it first to get an understanding of how a VLOOKUP works.

As promised here’s the second way to use a VLOOKUP, and I call it the Sorted List version as it relies on the data in the table you are referencing being sorted.

Let’s s set the scene so we can understand how this type of VLOOKUP can help us.

In the list below we want to calculate a commission in column E for each builder.  Our commission percentage is based on where the ‘Total $k’ figure falls into the ranges in our table in columns G-I.

Microsoft Excel 2007 VLOOKUP Lesson

Microsoft Excel describes the VLOOKUP formula as:

VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)

And to translate it into English it would read:

VLOOKUP(find this value, in that table, return the value in column x of the table)

You’ll notice I haven’t translated the last part of the formula ‘range_lookup’.  Unlike the VLOOKUP Exact Match formula where we put ‘False’ in this position, with the Sorted List version we want Excel to find the next best option in our table, and so we leave ‘range_lookup’ blank.

Let’s make it even clearer by applying it to row 3 in our example:

Remember we want Excel to find the Commission % Rate and enter it in cell E3, so in English our formula will read:

VLOOKUP(find where Total $k amount $3,112, falls in the Commission Rates table G3:I10, return the value in column 3 of the table)

And to enter it in our spreadsheet our VLOOKUP formula in column E for the above example would be:

=VLOOKUP(D3,$G$3:$I$10,3)

Microsoft Excel 2007 VLOOKUP Lesson

Let me clarify some points:

1)      ‘find where Total $k amount $3,112, falls in the Commission Rates table’ – Excel doesn’t actually take into consideration column H in our table.  I have simply put it there to help understand the commission ranges.  Excel is in fact looking for the exact amount $3,112 in our Commission Rates table, and when it can’t find it, it finds the next best lower amount and returns the value in column 3.

2)      ‘Return the value in column 3 of the table’ is referring to the column number in the table H2:I9, not the column number of the spreadsheet.  The information we want returned is the percentage rate, and it is in the third column of the Commission Rates table.

3)      If we had duplicates in our Commission Rates table Excel will find the last instance of the value and return the result in column 3.  For example, if instead of the amount $4001 in cell G8, you had $3001 again.  Excel would return the value of 6% as it’s finding the last best match for our amount.  The tip here is to remove any duplicates or you’ll end up with erroneous results.

4)      Unlike the VLOOKUP Exact Match version of the formula, this version requires the list to be sorted in ascending order.  Just like with duplicates explained above, if it’s not sorted you will end up with erroneous results.

You’ll notice in the formula bar above there are ‘$’ signs around the reference to the table.  This is called an absolute reference and it allows us to copy the formula down column E without Excel dynamically updating the table range as we copy.  To understand how to use shortcuts like absolute references you can get our Microsoft Office online training here.

How can we make this VLOOKUP formula even better?

As with our VLOOKUP Exact Match example let’s assume the end result of our example exercise is to calculate the commission $ amount.  Again we can do this in one step in column E.

Let’s say our commission is calculated as Total $k x Commission %, our formula in cell F3 would read:

=VLOOKUP(D3,$G$3:$I$10,3)*D3

Microsoft Excel 2007 VLOOKUP Lesson

Hopefully now you can begin to appreciate why the VLOOKUP is my favourite formula.  The concept behind it is pretty basic but it has amazing POWER.  Especially when you team it up with other formulas like IF statements, SUMIF and so on.

Download the Excel workbook used in this example so you can copy and practice the different VLOOKUP formulas to make sure you really get it and can take advantage of their power.

Want More Excel Formulas

Check out my previous tutorial for VLOOKUP Rules & Common Mistakes!

Or visit our list of Excel formulas. You’ll find a huge range all explained in plain English, plus PivotTables and other Excel tools and tricks. Enjoy :)

Feedback

Tell us how you use VLOOKUP formulas in your work by entering a comment below.

Did you find this useful?  Why not share the love and let your friends know.  Click the icons below for Twitter and Facebook.

Want more? Sign up for our newsletter below and receive weekly tips & tricks to your inbox, plus you’ll get our 100 Excel Tips & Tricks e-book.

Share This

Print Friendly and PDF

Please share this or leave a comment and I'll make sure you get a personal reply.

FREE PDF Download
100 Excel Tips & Tricks

Excel Tips & Tricks E-Book
Just enter your details below

Leave a Comment

{ 33 comments… read them below or add one }

julie wiston September 22, 2010 at 10:58 pm

It’s a great article comments and so nice your product. keep ruling on post. thanks…………………. :)

Reply

Mynda September 29, 2010 at 8:27 pm

Thanks for the comment @Julie Wiston. Glad you like it.

Reply

Reg October 5, 2010 at 1:50 am

This is such a great resource that you are providing

Reply

Philip Treacy October 5, 2010 at 12:37 pm

Thanks Reg. we really do hope people get a lot from our training. Spread the word :)

Reply

hmm...? October 13, 2010 at 11:21 pm

thanks

Reply

roclafamilia October 21, 2010 at 11:01 pm

Helpful blog, bookmarked the website with hopes to read more!

Reply

Andy G October 28, 2010 at 2:46 pm

great stuff. I think I understand vlookup now :)

Reply

Craig Forrester November 12, 2010 at 3:39 pm

thanks, most useful to me

Reply

Fawaz November 14, 2010 at 11:18 pm

Finally i found it as a great method to learn excel here.

Thanks a lot to the organizers.

Reply

dtg December 12, 2010 at 8:11 am

this site is fast

Reply

Roy Lachica October 23, 2011 at 1:59 pm

This is such a good reference / resource for my office work which involve large data… thanks…

Reply

Mynda Treacy October 23, 2011 at 9:42 pm

Thanks Roy. Glad to help.

Reply

niyaz April 24, 2012 at 6:18 pm

good

Reply

ASGHAR June 23, 2012 at 8:08 pm

I am a regular reader and as usual I find this article bearing much and useful information

Reply

Mynda Treacy June 24, 2012 at 11:29 am

Thanks, Asghar :)

Reply

Eric Juliana August 14, 2012 at 3:33 am

Hopi bon,

Very good!!!!

Reply

Mynda Treacy August 14, 2012 at 9:03 am

:) Cheers, Eric.

Reply

Eskinder Haile August 18, 2012 at 2:31 am

This is a good tutorial for those of us who want to understand Vlookup

Reply

Mynda Treacy August 19, 2012 at 9:41 pm

Thanks, Eskinder :)

Reply

taimoor September 15, 2012 at 10:38 pm

Best of luck dear. Your this addition is helpful to me. as my job is relating to such condition VLOOKUP

Reply

Mynda Treacy September 15, 2012 at 10:41 pm

Thanks, Taimoor.

Reply

Brian Nyanzi September 26, 2012 at 9:40 pm

it is a good resource

Reply

Mynda Treacy September 26, 2012 at 10:13 pm

Cheers, Brian :)

Reply

Joseph Horling January 16, 2013 at 4:20 am

Hi,

Just wanted to comment that your online training hub is really helping me in reviewing excel. Thanks so much for the simple explainations and the downloads to practice. And keeping it for free. Joe for Michigan.

Reply

Philip Treacy January 16, 2013 at 9:21 am

Thanks. Glad you like it, Joseph :)

Reply

sartaj February 2, 2013 at 7:41 pm

Thanks for sharing the usefull with all of us,………
It is very helpful.
Thanks once again.

Reply

Mynda Treacy February 2, 2013 at 8:32 pm

Thanks, Sartaj :)

Reply

Dave April 26, 2013 at 3:50 am

I need to create a vlookup (or “If” / “Or” statement) that only looks for values that are >229.0 or (but) 870 but less than 876.00. A sorting function.

Thanks

Reply

Carlo Estopia April 26, 2013 at 10:18 am

Hi Dave,

I don’t think this can be done by a Vlookup function.

Cheers,

CarloE

Reply

Enoch May 22, 2013 at 7:12 pm

Wow….this is new discovery for me.
Thanks

Reply

Mynda Treacy May 22, 2013 at 7:48 pm

Fantastic!

Reply

Patsiltri June 14, 2013 at 5:15 am

I love this site, use it lots.

Q; I like to have a summary sheet that calculates totals from several tabs in the schedule. The tabs are named: one, two, three, etc. Is there a way to use the name of the tab in formulas like vlookup and sumif? That way I can put the tab names in the summary and use it as a reference in the summary tab formula.

Reply

Carlo Estopia June 14, 2013 at 6:27 pm

Hi Patsiltri,

Precisely, you can use indirect function to materialize this.

Try to download the workbook in this particular blog and look for the SUMIF part:

3D SUMIF Across Multiple Workbooks

An excerpt from the sheet, SUMIF: =SUMPRODUCT(SUMIF(INDIRECT(“‘”&tabs&”‘!A3:A8″),$A6,INDIRECT(“‘”&tabs&”‘!E3:E8″))) .

Note: the tab names are contained in the named range ‘tabs’.

However, I don’t know how you would like to do it in a VLookup. Although it’s still possible to use indirect function together
with a VLookup function but it doesn’t make any difference at all. You may want to use this syntax/formula in the same sheet of
the downloadable file above:

 =VLOOKUP(A4,INDIRECT("'"&tabs&"'!A2:B2"),2,FALSE) 

Cheers,

CarloE

Reply

Previous post:

Next post: