Home / Blog / How to Use the XLOOKUP Function in Microsoft Excel

How to Use the XLOOKUP Function in Microsoft Excel

excel logo

Excel’s new XLOOKUP will exchange VLOOKUP, offering a strong substitute to one in every of Excel’s hottest capabilities. This new operate solves a few of VLOOKUP’s limitations and has additional performance. Right here’s what you must know.

What’s XLOOKUP?

The brand new XLOOKUP operate has options for among the greatest limitations of VLOOKUP. Plus, it additionally replaces HLOOKUP. For instance, XLOOKUP can look to its left, defaults to an actual match, and means that you can specify a variety of cells as a substitute of a column quantity. VLOOKUP isn’t this straightforward to make use of or as versatile. We’ll present you the way it all works.

For the second, XLOOKUP is barely obtainable to customers on the Insiders program. Anybody can be part of the Insiders program to entry the latest Excel options as quickly as they turn out to be obtainable. Microsoft will quickly start to roll it out to all Workplace 365 customers.

How you can Use the XLOOKUP Perform

Let’s dive straight in with an instance of XLOOKUP in motion. Take the instance knowledge under. We need to return the division from column F for every ID in column A.

Sample data for XLOOKUP example

It is a basic precise match lookup instance. The XLOOKUP operate requires simply three items of knowledge.

The picture under exhibits XLOOKUP with six arguments, however solely the primary three are essential for an actual match. So let’s give attention to them:

  • Lookup_value: What you’re searching for.
  • Lookup_array: The place to look.
  • Return_array: the vary containing the worth to return.

Information required by the XLOOKUP function

The next system will work for this instance: =XLOOKUP(A2,$E$2:$E$8,$F$2:$F$8)

XLOOKUP for an exact match

Let’s now discover a few benefits XLOOKUP has over VLOOKUP right here.

No Extra Column Index Quantity

The notorious third argument of VLOOKUP was to specify the column variety of the knowledge to return from a desk array. That is now not a difficulty as a result of XLOOKUP allows you to choose the vary to return from (column F on this instance).

The column index number argument of VLOOKUP

And don’t neglect, XLOOKUP can view the information left of the chosen cell, in contrast to VLOOKUP. Extra on this under.

You additionally now not have the difficulty of a damaged system when new columns are inserted. If that occurred in your spreadsheet, the return vary would regulate routinely.

Inserted column does not break XLOOKUP

Actual Match is the Default

It was at all times complicated when studying VLOOKUP why you needed to specify an actual match was needed.

Thankfully, XLOOKUP defaults to an actual match—the much more widespread purpose to make use of a lookup system). This reduces the necessity to reply that fifth argument and ensures fewer errors by customers new to the system.

So in brief, XLOOKUP asks fewer questions than VLOOKUP, is extra user-friendly, and can be extra sturdy.

XLOOKUP can Look to the Left

Having the ability to choose a lookup vary makes XLOOKUP extra versatile than VLOOKUP. With XLOOKUP, the order of the desk columns doesn’t matter.

VLOOKUP was constrained by looking the left-most column of a desk after which coming back from a specified variety of columns to the suitable.

Within the instance under, we have to lookup an ID (column E) and return the individual’s title (column D).

Example data for a lookup formula to the left

The next system can obtain this: =XLOOKUP(A2,$E$2:$E$8,$D$2:$D$8)

XLOOKUP function returning a value to its left

What to Do If Not Discovered

Customers of lookup capabilities are very conversant in the #N/A error message that greets them when their VLOOKUP or their MATCH operate can not discover what it wants. And infrequently there’s a logical purpose for this.

Subsequently, customers shortly analysis methods to disguise this error as a result of it’s not right or helpful. And, after all, there are methods to take action.

XLOOKUP comes with its personal built-in “if not discovered” argument to deal with such errors. Let’s see it in motion with the earlier instance, however with a mistyped ID.

The next system will show the textual content “Incorrect ID” as a substitute of the error message: =XLOOKUP(A2,$E$2:$E$8,$D$2:$D$8,"Incorrect ID")

Alternative text if not found with XLOOKUP

Utilizing XLOOKUP for a Vary Lookup

Though not as widespread as the precise match, a really efficient use of a lookup system is to search for a price in ranges. Take the next instance. We need to return the low cost dependent upon the quantity spent.

This time we aren’t searching for a selected worth. We have to know the place the values in column B fall inside the ranges in column E. That can decide the low cost earned.

Table data for a range lookup

XLOOKUP has an elective fifth argument (bear in mind, it defaults to the precise match) named match mode.

Match mode argument for a range lookup

You possibly can see that XLOOKUP has higher capabilities with approximate matches than that of VLOOKUP.

There may be the choice to search out the closest match smaller than (-1) or closest higher than (1) the worth seemed for. There may be additionally an choice to make use of wildcard characters (2) such because the ? or the *. This setting isn’t on by default prefer it was with VLOOKUP.

The system on this instance returns the closest lower than the worth seemed for if an actual match isn’t discovered: =XLOOKUP(B2,$E$3:$E$7,$F$3:$F$7,,-1)

A range lookup with a mistake

Nonetheless, there’s a mistake in cell C7 the place the #N/A error is returned (the ‘if not discovered’ argument was not used). This could have returned a 0% low cost as a result of spending 64 doesn’t attain the standards for any low cost.

One other benefit of the XLOOKUP operate is that it doesn’t require the lookup vary to be in ascending order as VLOOKUP does.

Enter a brand new row on the backside of the lookup desk after which open up the system. Increase the used vary by clicking and dragging the corners.

Fix the mistake by expanding the used range

The system instantly corrects the error. It’s not an issue with having the “0” on the backside of the vary.

Error fixed by expanding lookup table

Personally, I might nonetheless kind the desk by the lookup column. Having “0” on the backside would drive me loopy. However the truth that the system didn’t break is sensible.

XLOOKUP Replaces the HLOOKUP Perform Too

As talked about, the XLOOKUP operate can be right here to switch HLOOKUP. One operate to switch two. Wonderful!

The HLOOKUP operate is the horizontal lookup, used for looking alongside rows.

Not as effectively often known as its sibling VLOOKUP, however helpful for examples like under the place the headers are in column A, and the information is alongside rows four and 5.

XLOOKUP can look in each instructions – down columns and likewise alongside rows. Not do we’d like two totally different capabilities.

On this instance, the system is used to return the gross sales worth referring to the title in cell A2. It seems to be alongside row four to search out the title, and returns the worth from row 5: =XLOOKUP(A2,B4:E4,B5:E5)

XLOOKUP as a HLOOKUP function replacement

XLOOKUP Can Look From the Backside-Up

Usually, you must seek out a listing to search out the primary (typically solely) incidence of a price. XLOOKUP has a sixth argument named search mode. This allows us to change the lookup to start out on the backside and lookup a listing to search out the final incidence of a price as a substitute.

Within the instance under, we want to discover the inventory degree for every product in column A.

The lookup desk is in date order, and there are a number of inventory checks per product. We need to return the inventory degree from the final time it was checked (final incidence of the Product ID).

Sample data for a backwards lookup

The sixth argument of the XLOOKUP operate offers 4 choices. We’re concerned with utilizing the “Search last-to-first” choice.

Search mode options with XLOOKUP

The finished system is proven right here: =XLOOKUP(A2,$E$2:$E$9,$F$2:$F$9,,,-1)

XLOOKUP looking bottom-up a list of values

On this system, the fourth and fifth argument have been ignored. It’s elective, and we needed the default of an actual match.

Spherical-Up

The XLOOKUP operate is the eagerly awaited successor to each the VLOOKUP and HLOOKUP capabilities.

A wide range of examples have been used on this article to display the benefits of XLOOKUP. One in every of which is that XLOOKUP can be utilized throughout sheets, workbooks and likewise with tables. The examples have been stored easy within the article to assist our understanding.

Resulting from dynamic arrays being launched into Excel quickly, it might additionally return a variety of values. That is undoubtedly one thing value exploring additional.

The times of VLOOKUP are numbered. XLOOKUP is right here and can quickly be the de facto lookup system.

About Alan Murray

Check Also

How to Troubleshoot Bluetooth Issues on a Mac

Bluetooth provides you the liberty to make use of gadgets like keyboards and headphones wirelessly, …

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.