How to Select an Excel Pay Table Using INDEX and MATCH
Question details
The user needs to create a formula that dynamically selects the correct yearly pay table, locates the equipment type, and returns the appropriate pay rate based on an employee's years of service.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Managing employee payroll or calculating equipment rates across multiple identically structured yearly pay tables situated on a single worksheet.
- Observed behavior
- The user wants to retrieve the exact pay rate dynamically without manually searching or hardcoding references to multiple separated tables.
Ensure that your pay tables have perfectly consistent row headers (equipment types) and column headers (service years) to prevent mismatched lookup results.
Build a Dynamic INDEX and MATCH Formula
Use a combination of IF, INDEX, and MATCH functions to identify the correct table based on the year, then locate the specific row and column for the rate.
A two-way lookup requires identifying both the row (equipment) and column (service year). When multiple tables exist, you can use the IF or CHOOSE function within your INDEX formula to dynamically shift the lookup range based on a specified target year.
Select your yearly pay tables individually (e.g., cells for 2023 and cells for 2024) and assign them recognizable names like 'Table2023' and 'Table2024' in the Name Box next to the formula bar.
Use an IF statement to dictate which table to pull from based on the selected year. For example: IF(TargetYearCell=2023, Table2023, Table2024).
Write MATCH(Equipment_Cell, Equipment_Column_Range, 0) to locate the relative row number. Then write MATCH(Service_Year_Cell, Service_Year_Header_Range, 0) to locate the relative column number.
Wrap your table selector and both MATCH functions inside INDEX: =INDEX(IF(TargetYear=2023, Table2023, Table2024), MATCH(Equipment, Equip_Range, 0), MATCH(ServiceYear, Year_Range, 0)). Press Enter to execute the formula.

Normalize the Data and Use XLOOKUP or SUMIFS
If the pay tables are not strictly standardized, reorganizing the data into a single flat table makes lookup formulas significantly simpler and less error-prone.
Master Lookup Formulas with WPS Office
WPS Spreadsheet offers robust support for advanced lookup functions including INDEX, MATCH, XLOOKUP, and array formulas, making it simple to build dynamic payroll or rate calculation templates without limitations.
- 1. Open WPS Office: Download and launch WPS Office, then open your existing payroll or pay table spreadsheet.
- 2. Enter Advanced Formulas: Click the 'Formulas' tab on the top ribbon to access the Function Library, where you can easily insert and configure INDEX, MATCH, or XLOOKUP functions.
- 3. Evaluate and Troubleshoot: Use the 'Evaluate Formula' tool found under the Formulas tab to trace exactly how your nested MATCH functions calculate step-by-step to prevent errors.

Frequently Asked Questions
Can I use VLOOKUP instead of INDEX and MATCH for two-way lookups?
Yes, you can use VLOOKUP paired with the MATCH function. The VLOOKUP function can search for the equipment down the first column, while MATCH can be nested inside VLOOKUP to dynamically identify the column index number for the service year. However, INDEX and MATCH is generally preferred as it is faster and doesn't break if you insert new columns.
Why does my INDEX MATCH formula return an #N/A error?
An #N/A error typically means the MATCH function could not find the exact equipment name or service year in your headers. Ensure there are no hidden trailing spaces in your source cells and that your lookup criteria match the table headers perfectly. Using the 'Trim' function can help resolve text inconsistencies.
What is the advantage of using XLOOKUP over INDEX and MATCH?
XLOOKUP simplifies formula syntax significantly. It allows you to search horizontally and vertically at the same time and easily perform multi-criteria searches (using arrays) without needing complex nested IF statements to choose between multiple separate tables.
How do I lookup data from a pay table on a different worksheet?
When building your formula, simply navigate to and click on the target worksheet while selecting your lookup ranges. Excel or WPS Spreadsheet will automatically prepend the sheet name followed by an exclamation mark to the range reference (e.g., 'PayTables!A1:D10').




