You in all probability use VLOOKUP() operate to seek out precise matches in Microsoft Excel, however it’s also possible to discover the closest worth when you do not know the precise worth.

Microsoft Excel on screen

Picture: Wachiwit/Shutterstock

One in every of Microsoft Excel’s mostly used features is VLOOKUP(). It is a search operate that permits you to retrieve values by wanting up a corresponding worth. As an illustration, you may wish to return the value of an merchandise through the use of the merchandise’s title or a scholar’s last grade through the use of the scholar’s title. It is a versatile and intensely helpful operate. More often than not you will have an actual match, however generally, you’ll need to return the closest matching worth. On this article, you will find out about VLOOKUP() after which we’ll use it to discover a match that nearly matches the lookup worth.

SEE: 83 Excel ideas each person ought to grasp (eBioPic)

I am utilizing Microsoft 365 on a Home windows 10 64-bit system, however you’ll be able to work with earlier variations. You’ll be able to work with your individual information or obtain the demonstration .xlsx and .xls recordsdata. This operate works equally in Excel for the online. This text assumes you may have fundamental Excel abilities reminiscent of coming into features and sorting, however even a newbie ought to be capable to apply the directions efficiently.

How VLOOKUP() works in Excel

Excel’s VLOOKUP() operate returns a corresponding worth after matching a lookup worth utilizing the next syntax:

VLOOKUP(lookup_value, lookup_range, offset, is_sorted)

Desk A explains these arguments. 





That is the worth you are making an attempt to match.



This identifies the information vary.



This numeric worth identifies the corresponding column to the fitting of lookup_value.



It is a Boolean worth: TRUE or FALSE. TRUE is the default and signifies that lookup_value information is sorted. Use FALSE to point that lookup_value is not sorted.


In a nutshell, VLOOKUP() makes use of a lookup worth to return a worth in one other column. Now, let’s use it to seek out the closest matching worth.

The right way to discover the closest match with VLOOKUP()

More often than not you will use VLOOKUP() to seek out an actual match, however you should utilize it to seek out the closest match. You need to use this method once you’re uncertain of the precise worth or you could discover a vary of values. Now, let’s use this operate to return a product title for a worth, when the value is not an actual match utilizing the information set proven in Determine A. The hot button is the enter worth in H2. Enter the worth you are making an attempt to match, and the operate in H3 returns the closest worth it finds to the enter worth in H2. 

Determine A


  We’ll discover the closest matching costs.

Proper now, the operate in H3


returns a worth that does not make sense—it is unsuitable, however extra about that in a minute. For now, let’s assessment how this operate works inside context. You will enter your guess worth in H2. The operate then makes use of this worth to match a worth in column C, the primary column within the lookup vary (however not essentially the primary column within the information set). When it does not discover an actual match, it stops wanting when it finds the closest worth to the worth in H2 that is lower than that worth after which returns the product title for a similar row.

It isn’t working as a result of the information set is not sorted by the value column—the lookup worth. Proper now, the information set is sorted by the ID column. The repair is easy: run an ascending kind on the Unit Value column. To take action, click on any cell contained in the Unit Value column and select Kind Smallest to Largest from the Kind & Filter dropdown within the Modifying group on the House tab. Or click on AZ within the Kind & Filter group on the Information tab. Determine B reveals the outcomes. Utilizing the operate as is, the lookup column, on this case, the Unit Value column, should be sorted in ascending order.

Determine B


  After sorting, the VLOOKUP() operate returns the closest matching worth.

As you’ll be able to see, VLOOKUP() returns the product Konbu, which has a worth of $6. That worth is the closest worth to the lookup worth in H2, 6.50, with out being higher than 6.50. For those who change the lookup worth in H2 to 7 or 8.99, it continues to return Konbu. For those who change the worth in H2 to 9.10, it returns Tunnbröd.

SEE: Home windows 10: Lists of vocal instructions for speech recognition and dictation (free PDF) (eBioPic)

At this level, you is perhaps questioning what occurs when you enter a worth that is an actual match. The operate returns the product title for the precise match. If there are two matching values, it returns the primary. That is how the VLOOKUP() works. What permits us to discover a close to match is the enter worth in H2. The approach does not do something particular in any respect; I’ve merely uncovered this conduct.

Keep in mind that elective argument is_sorted? Proper now, the operate depends on the default worth, TRUE. For those who change that argument to FALSE, the operate works just for precise matches within the Unit Value column, and it does not matter if that column is sorted. Nevertheless, it will not work if the column is sorted in descending order.

This little-known conduct could be put to nice use when precise values are unknown, and also you want the pliability to guess. 

Additionally see

Leave a Reply