Function Problems

How to Return a Historical Value by Date Using INDEX and MATCH in Spreadsheets

Amos GikundaAmos Gikunda Nov 11, 2026 869 views

Question details

Retrieve the latest historical value of an application up to a specified date, correctly accounting for scenarios where the value may have changed multiple times on the exact same day.

How to Return a Historical Value by Date Using INDEX and MATCH
Product
Spreadsheets
Device & OS
not provided
Scenario
Looking up the most recent status or value from a chronological log based on a specific target date.
Observed behavior
Extracting the correct value requires isolating the latest matching record whose edit date is less than or equal to the target date using array formulas.
Before you start

Ensure your historical data table is sorted chronologically by the edit date, and secondarily by the change sequence or time if multiple edits occur on the exact same day.

Solution 1Recommended

Use an Array Formula with INDEX, LARGE, and IF

Utilize an array formula to find the maximum row number that matches your specific criteria and is less than or equal to the requested date.

To return the correct historical value, a standard lookup is not enough when there are multiple updates. By combining the INDEX, LARGE, IF, and ROW functions as an array formula, the spreadsheet evaluates the entire column to find the exact row of the latest update.

When an application can change twice on the same date, sorting the history by edit date and sequence is mandatory so the formula defaults to selecting the absolute latest change.

1
Sort the Historical Data

Highlight your history data range. Go to the Data tab and click Sort. Sort primarily by 'Edit Date' (Oldest to Newest) and add a secondary sort level for 'Change Sequence' or 'Time' (Smallest to Largest).

2
Enter the Array Formula

Select the target cell where you want the historical value to appear. Enter the formula: =IFERROR(INDEX(History!$D$2:$D$8589, LARGE(IF((History!$A$2:$A$8589=B2)*(History!$E$2:$E$8589<=$V$1), ROW(History!$G$2:$G$8589)-1), 1)), INDEX(History!$C$2:$C$8589, MATCH(B2, History!$A$2:$A$8589, 0))). Replace the sheet name 'History' and cell references with your actual ranges.

3
Confirm as an Array Formula

Instead of pressing just Enter, hold down Ctrl + Shift and press Enter. This tells the spreadsheet to evaluate the formula as an array. Curly brackets {} will automatically appear around the formula in the formula bar.

Use an Array Formula with INDEX, LARGE, and IF
Formula Execution: If you see the curly brackets {}, the array formula is active. The IFERROR portion provides a reliable fallback if the specific date yields no initial result.
Advanced Spreadsheets

Easily Analyze Historical Data with WPS Spreadsheet

WPS Spreadsheet fully supports complex array formulas, including combinations of INDEX, MATCH, LARGE, and IF, allowing you to quickly process historical records and time-stamped data without performance drops.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your application history.
  2. 2. Sort the records: Navigate to the Data tab and use the Custom Sort tool to organize your table by date and sequence.
  3. 3. Input the lookup formula: Paste your INDEX and MATCH array formula into the designated cell.
  4. 4. Execute the array: Press Ctrl+Shift+Enter to retrieve the correct historical value and drag the fill handle to apply it to other rows.
Full compatibility with Microsoft Excel formulas, functions, and array inputsProcesses complex array formulas (Ctrl+Shift+Enter) seamlesslyFree, lightweight, and fast calculation engine ideal for large datasetsBuilt-in advanced sorting tools to quickly organize chronological data
microsoft office alternative - wps office

Frequently Asked Questions

Why do I need to press Ctrl+Shift+Enter for this formula?

Pressing Ctrl+Shift+Enter converts a standard formula into an array formula. This is necessary because the IF function inside the formula needs to evaluate multiple conditions across entire ranges of data (arrays) rather than just single cells.

What happens if my historical data is not sorted?

If the data isn't sorted chronologically, the LARGE or MATCH functions might pull a row number that is factually incorrect, especially if there are multiple updates on the exact same date. Always sort your data by date and time sequence first.

Can I use XLOOKUP instead of INDEX and MATCH?

Yes. If you are using a newer spreadsheet version that supports XLOOKUP, you can use it with a search mode of -1 (search last to first) combined with an exact match or next smaller item mode. However, your data must still be sorted chronologically for accurate results.

Why is the IFERROR function included in the formula?

IFERROR acts as a fallback mechanism. It handles situations where no historical record matches the criteria on or before your specified date, reverting the result to an initial MATCH query or preventing an ugly #N/A error from displaying.