How to use the XLOOKUP function in Excel – 9 practical examples.

Excel’s XLOOKUP function is a game-changer for anyone working with data. Its versatility and power make it an essential tool for simplifying the process of searching and retrieving information within spreadsheets. Whether you’re a beginner or an experienced Excel user, XLOOKUP can transform the way you handle data.

As Excel’s latest lookup function, XLOOKUP is designed to replace and improve upon its predecessors, VLOOKUP and HLOOKUP, by overcoming many of their limitations. With XLOOKUP, you can search for values in a range or array and retrieve corresponding data seamlessly, regardless of whether the search is horizontal or vertical.

In this blog, we’ll explore nine practical examples that demonstrate the incredible flexibility of XLOOKUP, showing you how to maximize its potential for solving real-world challenges.

I have used a list of Employee data to explain the nine cases of using the XLOOKUP function.

In this case we have the List of employees and their salaries.

Finding Employee salary - Formula
Finding Employee salary – Formula

Now to find the salary of “Employee B” use the following XLOOKUP Function

As you can see in the formula the references are meaningful. This is because I have used the Table format to structure the raw data.

To do this, Select the cells of the raw data and click Ctrl + T. And then you can name the table. 

When a new employee is added to the table, “XLOOKUP” returns the  salary of Employee L.

The Table structure makes the formula readable & scalable.

In this case, there’s an employee L who is not in the list of employees who will be receiving a bonus. 

Here, “IF NOT FOUND“ argument is used in the XLOOKUP function. This argument would return the value “0” if no match is found.

When employee L is searched for, the XLOOKUP returns the value “0” as the employee is not available in the list. 

Whereas when employee B is searched for it returns the bonus of the employee from the table.


In this case we have multiple records for each employee. An employee has a new record when salary changes.

Here we use the sixth argument “Search Mode” in the XLookup function.The fifth argument “Exact Match” is by default set to 0. 

In this formula, “Search Mode = 1” will pick the employee that is first from the start. “Search More = -1” will pick the employee that is first from the last.

First:  Now for Employee A, if I use “Search Mode = 1” then the first occurrence of A is returned by excel.

Last:  Now, for Employee A, if I use “Search Mode = – 1” then the last occurrence of A is considered by Excel.

We have the List of employees and their salaries.

We already know how to get the first salary for the first employee.

We can find the first salary for all the employees in 3 methods. 

Method 1: Click H4 and drag the formula to the cells below.

Method 2: To change the reference F4 to F4:F9 in the formula where F4 to F9 has the list of employee names.

Method 3: If the list of employees is a dynamic array, then we can change F4 to F4# and this will give the array of results. To create a dynamic array of employee names, we can use UNIQUE function.

If a new employee is added to the dataset the result will automatically expand to accommodate the new input.

Here, we have the List of employees and the performance score.

To get the employee’s corresponding score, we use this formula, which fetches the score from column D and returns it in G5.

We have a reference table that has the score and its respective rating 

In the lower bound reference table we have the scores 0, 40, 70 and 90 and their respective ratings are Unsatisfactory, Needs Improvement, Average and Exceeds expectation

Now, for Employee F, to get the rating for a score of 40, we use this formula where it looks at the score in cell G5 and returns the rating.

For employee F, the score is 40 and so the performance rating would be “Needs Improvement”

When the value is not an exact match, it will still work since we use match mode equals -1 to get the next lower item.

For example, employee A has a score of 76. In this case the next lower item in the reference table is 70 thereby the performance rating will be “Average”.

If your reference table is based on upper bound, we can modify the formula slightly to handle it. The match mode parameter can be set to 1.

In the upper bound reference table, we have the scores 39, 69, 89 and 100 and their respective ratings are Unsatisfactory, Needs Improvement, Average and Exceeds expectation.

In this case we use match mode equals 1 to get the next larger item. For example, employee A has a score of 76. In this case the next larger item in the reference table is 89 thereby the performance rating will be “Average”.

Partial match is used to find the data if a part of the data is already known. Consider we know the first name of the employee and the last name is unknown. 

Here “2” represents the” Wild card character” match mode.

Asterisk is used as the wildcard character and this will populate the score for the name that starts with the name ”William”

The same can be applied for the name for which the last name is known and the first name is unknown.Here we replace the First name with wild card character “asterisk”. This will populate the score for the name that ends with the name ”Baker”

Let’s assume you want to get two pieces of information from the table.

We want to return back both Title and Bonus in the XLOOKUP formula.

If you want to align both Title and bonus vertically instead of horizontally, then use TRANSPOSE function.

In this example we will find the score based on two conditions – the Employee name and Department.

Let’s take the Employee name  “Kenneth Baker”. There are two Kenneth Baker, one from the Finance department and another from the HR department. 

We are going to use the formula, where the Name matches the name that we are looking for AND the Department matches the same department that we are looking for.

In this example the salary changes over time. However the data is not sorted by date.

We are going to do this in two parts

  1. Here we use the “MAXIFS” function to get the max date when the employee column matches the employee we are looking for.

2. Now to get the salary of the employee on the max date, we will use the following formula.

Where cell I4 is the result of the MAXIFS done earlier. 

This will return the salary of the employee that equals the name of the employee in the cell and the date equals the max date in the cell. 

Leave a Reply

Your email address will not be published. Required fields are marked *