Function Problems

Why XLOOKUP Order Matters in a Two-Way Approximate Match

Steven ParkerSteven Parker Nov 3, 2026 868 views

Question details

Understand how the order of nested XLOOKUP formulas impacts the results when performing two-dimensional approximate matches.

Why XLOOKUP Order Matters in a Two-Way Approximate Match
Product
WPS Spreadsheet
Device & OS
not provided
Scenario
Performing a two-dimensional (two-way) lookup that requires an approximate match on either the row or column axis.
Observed behavior
The formula returns incorrect data or fails to align arrays properly when the approximate match is placed in the outer lookup function.
Before you start

Ensure your lookup data ranges are correctly sorted in ascending or descending order, as approximate matches require properly sorted data to return the expected result.

Solution 1Recommended

Structure the Approximate Match in the Inner XLOOKUP

To correctly perform a two-way lookup where one axis requires an approximate match, place the approximate match logic in the inner (nested) XLOOKUP function.

When nesting XLOOKUP functions for a two-way lookup, the inner XLOOKUP processes first and returns an entire row or column array to the outer XLOOKUP.

If an approximate match (-1 or 1) is evaluated first on the inside, it successfully retrieves the corresponding row or column array based on the approximate target, which is then passed to the outer exact match lookup. If both matches are exact (0), the nesting order does not matter.

1
Identify lookup requirements

Determine which lookup axis requires an exact match (e.g., column headers) and which requires an approximate match (e.g., numeric thresholds or dates).

2
Write the inner approximate lookup

Create the inner XLOOKUP function using your approximate match parameters. For example: XLOOKUP(I2, B3:B20, B3:G20, "N", -1) where -1 specifies exact match or next smaller item.

3
Wrap with the outer exact lookup

Enclose the inner function inside the outer XLOOKUP that handles the exact match. For example: =XLOOKUP(J2, B3:G3, XLOOKUP(I2, B3:B20, B3:G20, "N", -1)).

4
Calculate the result

Press the Enter key to execute the nested formula and retrieve the targeted value.

Structure the Approximate Match in the Inner XLOOKUP
Exact Match Exception: If both axes of your two-way lookup require an exact match (match mode 0), the nesting order of the row and column lookups does not matter.
Efficient Spreadsheet Data Analysis

Perform Advanced Lookups with WPS Spreadsheet

WPS Spreadsheet fully supports the modern XLOOKUP function, making complex two-way lookups and approximate matches straightforward. Enjoy a robust calculation engine that handles your formulas seamlessly.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your dataset.
  2. 2. Select the target cell: Click on the cell where you want the two-way lookup result to appear.
  3. 3. Input the formula: Type =XLOOKUP( to trigger the formula assistant, which will guide you through entering lookup_value, lookup_array, return_array, and match_mode.
  4. 4. Complete the formula: Nest your inner XLOOKUP as the return_array of the outer XLOOKUP, close the parentheses, and press Enter.
Full format and formula compatibility with Microsoft Excel files (.xlsx).Lightweight software with high-speed calculation capabilities for large datasets.Intuitive formula syntax tooltips and built-in error-checking assistance.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my nested XLOOKUP return a #VALUE! error?

This error typically occurs if the dimensions of your lookup arrays do not align perfectly. Ensure that the return array of the inner XLOOKUP has the exact same number of items as the lookup array of the outer XLOOKUP.

What does the match_mode -1 mean in XLOOKUP?

A match mode of -1 instructs the XLOOKUP function to search for an exact match first. If an exact match is not found, it returns the next smaller item. This requires the lookup array data to be evaluated logically.

Can I use XLOOKUP for two-way approximate matches in older spreadsheet versions?

XLOOKUP is a modern function and may not be available in older software versions. For legacy software, you can achieve two-way approximate matches using a combination of INDEX and MATCH functions with the correct match types.