ICAEW.com works better with JavaScript enabled.
Exclusive

Excel, what’s occurrin’ 9 – The Wrong Trousers

Author: Simon Hurst

Published: 16 May 2025

Exclusive content
Access to our exclusive resources is for specific groups of students, subscribers and members.

This series looks at some of the things that can go wrong in an Excel spreadsheet and at what we can do to avoid or resolve the issue. The first six parts dealt with issues that cause numbers to appear not to add up correctly. This time, we move on from Data Validation to lookup functions.

Introduction

The series so far:

Choosing items from a list

In part 8 of this series, we looked at Data Validation including the use of Data Validation to select items from a dropdown list. Sometimes, you might want to return the value of an item from one column in a list by choosing an item from a different column in the same row. Excel has several lookup and match functions that can help and, until recently, the most frequently used was probably VLOOKUP(). This function allows you to specify a lookup value which is then compared to the first column in a range that contains at least two columns. The third argument of VLOOKUP() specifies from which column number to return the value.

VLOOKUP() – warning: extreme danger

Here is our example, adapted from the previous article. We have changed our list of products to feature lower body wear and added a column of sales values. We use Data Validation in cell E2 with our Product column as our Source list. We have added our VLOOKUP() formula to cell F2 to return the value of sales for the product that we have chosen from our list:

=VLOOKUP(E2,ProductList,2)

Image illustrating the VLOOKUP() formula in Excel
Our VLOOKUP() function compares our Type entry in cell E2 with the first column of our ProductList Table and returns the value from column 2 of the first row that matches.

So far so good, but let’s now choose ‘Linen’ from our dropdown list, without making any other changes:
Image illustrating the VLOOKUP() formula in Excel

Oh no! It’s the wrong trousers!

Although we have selected ‘Linen’, our VLOOKUP() function returns the value from our ‘Cropped’ row. What could have gone wrong? In fact, nothing has gone wrong, VLOOKUP() is working exactly as intended.

The issue is the fourth argument of VLOOKUP() which we have not specified in our formula. This fourth argument defines the type of match that the function uses to find the right row. The choice is between an approximate match and an exact match. If the argument is set to TRUE or just omitted, VLOOKUP() defaults to performing an approximate match. You might think that ‘approximate’ just means the closest spelling to our match item to allow for a minor error when entering our match term – something that using a Data Validation list should avoid anyway. However, in the case of VLOOKUP(), approximate has a much more specific meaning.

VLOOKUP() performs an exact match by starting at the top of our list and checking each item against the match term until it finds a match. Before recent performance improvements, this meant that VLOOKUP() could take longer for longer lists. An approximate match is performed in a completely different way to speed up the operation. Instead of starting at the top and working through the list, the search for a match begins in the middle of the list and keeps halving the list of items to look through, thus massively speeding up the process compared with potentially checking every item. For this to work, the list must be sorted in ascending order, to ensure that the match searches in the right half of the list each time.

The more detailed explanation is that the approximate match finds the smallest item in a list, sorted in ascending order, that is smaller than, or equal to, the match value. To show how this works in our example, Cropped is the middle item in our list (which explains why our match for Cropped did return the correct value). For Linen, an approximate match assumes that the values in the list are sorted in ascending order so, given that Linen comes alphabetically after Cropped, it won’t try and match any values earlier in the list than Cropped. This process continues in our unsorted list until the match decides that the smallest item in our list that is greater than or equal to Linen is Cropped.

We can address the issue by always remembering to specify our fourth argument. If we set it to FALSE, our match will be exact, and the correct value will be returned:

Image illustrating the VLOOKUP() formula in Excel

We could also sort our list in ascending order but, if we were not using a Data Validation list, this would run the risk that making an error in entering our match value could result in an incorrect match rather than returning a warning error message.

XLOOKUP()

There is another way to sort out our approximate/exact issue. Excel now has an improved lookup function: XLOOKUP(). This defaults to performing an exact match, reducing the chances of a simple act of omission causing a catastrophic error with no warning. In addition, XLOOKUP() has a range of additional features that greatly improve its performance and flexibility compared to both VLOOKUP() and its horizontal expression: HLOOKUP():

Image illustrating the XLOOKUP() formula in Excel

Given XLOOKUP() is an all-round better option than VLOOKUP(), you might be wondering why we’ve bothered covering the legacy function. Whilst using XLOOKUP() in all versions of Excel that support it would be advisable, many people will come across spreadsheets that still use VLOOKUP(), either because of when they were originally created or because the creator was unaware of the introduction of the improved function. Such is the potential danger of the incorrect use of VLOOKUP() that knowing its deficiencies might prevent many a close shave.

Next time

Next time we will look at dealing with inappropriate dates when working with PivotTables.

Additional resources

You can explore all aspects of Excel, including many articles on lookup functions in general and XLOOKUP() in particular, in the ICAEW archive.

Archive and Knowledge Base

This archive of Excel Community content from the ION platform will allow you to read the content of the articles but the functionality on the pages is limited. The ION search box, tags and navigation buttons on the archived pages will not work. Pages will load more slowly than a live website. You may be able to follow links to other articles but if this does not work, please return to the archive search. You can also search our Knowledge Base for access to all articles, new and archived, organised by topic.

Open AddCPD icon

Add Verified CPD Activity

Introducing AddCPD, a new way to record your CPD activities!

Log in to start using the AddCPD tool. Available only to ICAEW members.

Add this page to your CPD activity

Step 1 of 3
Download recorded
Download not recorded

Please download the related document if you wish to add this activity to your record

What time are you claiming for this activity?
Mandatory fields

Add this page to your CPD activity

Step 2 of 3
Mandatory field

Add activity to my record

Step 3 of 3
Mandatory field

Activity added

An error has occurred
Please try again

If the problem persists please contact our helpline on +44 (0)1908 248 250