Everything You Need To Know About XLOOKUP - KING OF EXCEL

KING OF EXCEL

KINGEXCEL.INFO ( KING OF EXCEL ) Welcome KINGEXCEL.INFO - Nothing Is Unable ... About Excel Tricks, Learning VBA Programming, Dedicated Software, Accounting, Living Skills ...

Friday, September 25, 2020

Everything You Need To Know About XLOOKUP

Everything You Need To Know About XLOOKUP

There was big news in the Excel world recently. A new replacement for the most famous Excel function was announced.
Move over VLOOKUP, your time in the spotlight is over!
XLOOKUP is here and it can do everything VLOOKUP can do and more!
Let’s take a look at this new function in detail.

Video Tutorial


Problems With VLOOKUP

Why bother introducing a new lookup function? VLOOKUP works just fine, right?
Well, there are a lot of problems with VLOOKUP that a beginner user might not be aware of. When we’re not aware, things can go wrong and we might end up getting incorrect results.
  • The VLOOKUP default is not an exact match. The 4th argument in VLOOKUP is optional, but the default is to use an approximate match. This can often lead to incorrect results.
  • VLOOKUP can only search from the first to last item and returns the first match.
  • VLOOKUP can’t return results from the left, it can only return results to the right of the lookup column. This means we sometimes end up needing to rearrange or add helper columns to our data.
  • VLOOKUP needs to reference an entire table. This means we are potentially referencing a lot of cells unnecessarily and this can be very inefficient when recalculating a workbook.
  • The lookup column needs to be the first column in our referenced table. Again, this can sometimes mean needing to awkwardly rearrange our data.
  • Deleting or inserting columns can break VLOOKUP. The 3rd argument column reference is often entered as a hard coded value. This means if we insert or delete a column the relative position of the return column to the lookup column can change but the hard coded value will not update. This can cause our VLOOKUP’s to return errors or unintended results.
  • Approximate match can only return the next smallest item.
  • Approximate match needs data sorted in ascending order. Unsorted data in this situation can lead to incorrect results.
XLOOKUP aims to fix these problems.

What Versions Of Excel Will Have XLOOKUP?

Only Excel for Office 365 will get the new XLOOKUP function. Excel 2019 and all previous versions won’t ever get this new function.
XLOOKUP is currently only available to those enrolled in the Office Insiders program. But it will eventually become generally available to all Office 365 users.

XLOOKUP Syntax

So what does an XLOOKUP look like? There are 3 required arguments and 2 optional arguments.
= XLOOKUP ( lookup_value, lookup_array, results_array, [match_mode], [search_mode] )
  • lookup_value (required) – This is the value we want to look up.
  • lookup_array (required) – This is the array of values we want to find the lookup_value in.
  • results_array (required)- This is the corresponding array of values we want to return results from.
  • [match_mode] (optional) – This is the type of match to return. If this argument is not entered, the default will be an exact match.
    • 0 = An exact match is returned. If no exact match is found, an #N/A error is returned. This is the default match mode.
    • -1 =  An exact match is returned. If no exact match is found, the next smallest value is returned.
    • 1 = An exact match is returned. If no exact match is found, the next largest value is returned.
    • 2 = An exact match is returned, but special characters ?* and ~ will act as the wildcard characters in a lookup_value allowing us to return partial matches.
  • [search_mode] (optional) – This is the type of search to perform. If this argument is not entered, the default will be to search from first to last.
    • 1 = Performs the search from the first to last item in the lookup_array and will return the first match from the results_array.
    • -1 = Performs the search from the last to first item in the lookup_array and will return the last match from the results_array.
    • 2 = Performs a binary search from the first to last item in the lookup_array. Our results_array will need to be sorted in ascending order, or the results may be incorrect.
    • -2 = Performs a binary search from the last to first item in the lookup_array. Our results_array will need to be sorted in descending order, or the results may be incorrect.

XLOOKUP Only Requires Three Arguments

XLOOKUP sounds more complicated than VLOOKUP! There are definitely more options available.
99% of the time though, we’ll want to perform a basic exact match lookup. XLOOKUP only needs the first 3 arguments to do this. This makes XLOOKUP more simple than VLOOKUP in this situation.
Simple-Exact-Match-XLOOKUP-Example Everything You Need To Know About XLOOKUP
= XLOOKUP ( B2, Countries[Country], Countries[Population] )
In this example, we want to return the population for a given country.
We want to find an exact match for the country and return its corresponding population from the table of data.
We only need to use the first three arguments in XLOOKUP to find and return an exact match.

XLOOKUP Can Return Results From The Left

The lookup array and results array are referenced independently. As a consequence, this means XLOOKUP is able to return results to the left of the lookup array.
XLOOKUP-Right-to-Left-Example Everything You Need To Know About XLOOKUP
= XLOOKUP ( B2, Countries[Capital], Countries[Country] )
In this example, we want to return the country for a given capital city.
This time we place the country column as the results array argument, and we’re able to lookup from right to left with no problems!

XLOOKUP Can Return Horizontal Results

XLOOKUP is also going to replace HLOOKUP, because it can return horizontal results too.
The lookup array and results array don’t need to be vertical. They can be horizontal arrays as well.
In fact, the “X” in XLOOKUP was choosen in part because it works with both vertical and horizontal data.
Bye-bye HLOOKUP!
#evba #etipfree #eama #kingexcel
📤How to Download ebooks: https://www.evba.info/2020/02/instructions-for-downloading-documents.html?m=1

No comments:

Post a Comment