How to Search an Excel Array and Return Matching Row and Column Values
Question details
The user needs to search a 2D data array with a specific input value to find the closest match (greater than or equal to the input) and retrieve the corresponding row and column headers.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- When querying complex datasets like a crane capacity chart, users must input a known weight to find the appropriate crane configuration, which requires returning data from both the row and column headers of the matched capacity value.
- Observed behavior
- Standard lookup functions only search a single row or column, making it difficult to search an entire 2D array and extract both header dimensions simultaneously.
Ensure your 2D array is structured with distinct, clearly labeled row and column headers. For complex matches, clearly define the rules for resolving duplicate values, as multiple row/column combinations may yield the same capacity.
Use an Array Formula with MIN, IF, and SUMPRODUCT
Use a combination of array formulas to first find the exact matching value in the 2D grid, and then extract the corresponding row and column headers.
Since the MATCH function natively searches only 1D ranges, searching a 2D table requires a two-step approach: identifying the closest matching value, then using matrix multiplication logic (like SUMPRODUCT) to pinpoint its exact coordinates.
Designate a cell for your input value (e.g., enter your target weight in cell H1).
In a new cell, use an array formula to find the minimum value that is greater than or equal to your input. For example: =MIN(IF(B2:F10>=H1, B2:F10)). Press Ctrl+Shift+Enter to evaluate it as an array formula.
Once the matched value is found (assume it is in H2), use SUMPRODUCT to locate the row header: =INDEX(A2:A10, SUMPRODUCT((B2:F10=H2)*ROW(A1:A9))).
Similarly, use SUMPRODUCT to locate the column header: =INDEX(B1:F1, SUMPRODUCT((B2:F10=H2)*COLUMN(A1:E1))).

Unpivot the 2D Array for Standard Lookups
Transform your 2D capacity chart into a flat 1D list containing 'Row Header', 'Column Header', and 'Value'. This makes searching for the nearest value straightforward.
Search and Analyze Complex Arrays with WPS Spreadsheet
WPS Spreadsheet provides a robust calculation engine that handles complex array formulas with ease. Whether you are using nested INDEX/MATCH combinations or modern dynamic arrays to retrieve row and column coordinates, WPS Office streamlines your data analysis tasks.
- 1. Open your array data: Launch WPS Spreadsheet and open the document containing your capacity chart or 2D array.
- 2. Enter your search formula: Select the target cell and type in your INDEX, MATCH, or MINIFS formula to define the search criteria.
- 3. Execute array calculations: Use the shortcut Ctrl+Shift+Enter to apply the array formula, allowing WPS Spreadsheet to instantly return the matched row and column values.

Frequently Asked Questions
Why does my standard MATCH formula return an error on a 2D array?
The MATCH function is designed to search a one-dimensional array (either a single row or a single column). When applied to a 2D grid, it will return an #N/A error. You must use array formulas or flatten the data to search across multiple dimensions.
Can I use XLOOKUP to return row and column headers from a 2D table?
XLOOKUP is excellent for two-way lookups (finding an intersection when the row and column are known). However, if you are searching the inner grid values to find an unknown row and column, XLOOKUP alone is insufficient. You will need to flatten the data or use matrix logic.
How do I deal with duplicate matching values in my capacity chart?
If your chart contains multiple identical values that meet your criteria, matrix-based formulas like SUMPRODUCT may fail. The best approach is to unpivot the data into a flat table and use the FILTER function to display all valid row and column combinations simultaneously.




