XMATCH Function Alternatives in Google Sheets

Published on

If you’re looking for alternatives to the Excel XMATCH function in Google Sheets, you’re in the right place! This post provides alternative formulas to match nearly all XMATCH variations.

Update: The XMATCH function is now available in Google Sheets. Learn more here – XMATCH Function in Google Sheets (Formula Examples).

Although Google Sheets now supports the XMATCH function, alternative formulas can still be useful. For those unfamiliar with XMATCH, it’s a modern lookup function that returns the relative position of a value within a row or column.

In Google Sheets, the MATCH function can serve as an alternative to XMATCH. However, achieving the same functionality may require combining MATCH with other functions. So, learning MATCH alone won’t be enough!

Don’t worry—I’ll guide you through using MATCH as an XMATCH alternative, including some additional functions.

XMATCH Function Alternatives in Google Sheets

In Excel, we commonly use XMATCH for the following purposes:

Sr. No.DescriptionMatch TypeResponse to Duplicates
1Find the relative position of an item in a row or columnExactFirst value
2-do-Exact Last value
3-do-Exact or Next Largest First value
4-do- Exact or Next Largest Last value
5-do- Exact or Next Smallest First value
6-do- Exact or Next Smallest Last value

Take note of the last two columns in the table. When creating XMATCH alternatives in Google Sheets, ensure that the formulas work with both numbers and text strings.

Here are six alternative XMATCH formulas in Google Sheets based on the scenarios in the table above:

Example 1 – Relative Positions in a Numeric Array

Consider the following vertical array in Google Sheets, where we’ll test six XMATCH alternatives.

Sample Numeric Data to Test XMATCH Alternatives
image_1
  • Lookup range/array: A2:A10, containing numeric values.
  • Note: You do not need to sort the range for these examples.

Below are the formulas in order of the match type and response to duplicates from the table above. Replace “Lookup_Value” with the value you’re matching.

  1. Exact match, first occurrence
    • Google Sheets Formula: =MATCH(Lookup_Value, A2:A10, 0)
    • Excel Formula: =XMATCH(Lookup_Value, A2:A10, 0, 1)
  2. Exact match, last occurrence
    • Google Sheets Formula: =ArrayFormula(MATCH(1, 1/(A2:A10=Lookup_Value), 1))
    • Excel Formula: =XMATCH(Lookup_Value, A2:A10, 0, -1)

In the following examples, we’ll use the additional functions SORTN and FILTER.

  1. Exact match or next largest, first occurrence
    • Google Sheets Formula: =ArrayFormula(MATCH(1, 1/(A2:A10=SORTN(FILTER(A2:A10, A2:A10>=Lookup_Value))), -1))
    • Excel Formula: =XMATCH(Lookup_Value, A2:A10, 1, 1)
  2. Exact match or next largest, last occurrence
    • Google Sheets Formula: =ArrayFormula(MATCH(1, 1/(A2:A10=SORTN(FILTER(A2:A10, A2:A10>=Lookup_Value))), 1))
    • Excel Formula: =XMATCH(Lookup_Value, A2:A10, 1, -1)
  3. Exact match or next smallest, first occurrence
    • Google Sheets Formula: =ArrayFormula(MATCH(1, 1/(A2:A10=SORTN(FILTER(A2:A10, A2:A10<=Lookup_Value), 1, 0, 1, 0)), -1))
    • Excel Formula: =XMATCH(Lookup_Value, A2:A10, -1, 1)
  4. Exact match or next smallest, last occurrence
    • Google Sheets Formula: =ArrayFormula(MATCH(1, 1/(A2:A10=SORTN(FILTER(A2:A10, A2:A10<=Lookup_Value), 1, 0, 1, 0)), 1))
    • Excel Formula: =XMATCH(Lookup_Value, A2:A10, -1, -1)

Example 2 – Relative Positions in a Text Array

The six formulas above work equally well with text arrays. Here’s an example showing their results for a text array. You can use the same lookup range and formulas.

XMATCH Alternatives Using Text Criteria
image_2

If you’re an Excel or Google Sheets user interested in the original XMATCH formulas, the Excel counterparts provided above will also work in Google Sheets.

That’s it for XMATCH function alternatives in Google Sheets! Thank you for reading. Enjoy exploring these formulas!

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Hierarchical Numbering Sequences in Excel

Creating hierarchical numbering sequences in an Excel spreadsheet can significantly improve the way you...

How to Easily Repeat a Sequence of Numbers in Excel

Excel offers multiple ways to accomplish tasks, and the simplicity of each approach depends...

Create a Sequence of Dates at Every Nth Row in Excel (Dynamic Array)

Would you like to create a sequence of dates in every nth row in...

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

More like this

Days Between Weekday Names in Excel and Google Sheets

There isn't a specific function to calculate the number of days between weekday names...

Display Month Names Only at Month Start (Excel & Google Sheets)

This tutorial explains how to display month names only at the start of each...

SUMIFS with XLOOKUP in Excel and Google Sheets

SUMIFS and SUMIF are infamous for producing an "argument must be a range" error...

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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