Function Problems

Fix an Excel Formula Returning the Wrong Index for a Date

Rana GarciaRana Garcia Dec 2, 2026 869 views

Question details

Find the index value associated with an entered date using a table of dates and index values.

Fix an Excel Formula Returning the Wrong Index for a Date
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user enters a date and wants a formula to return the index for the applicable date range.
Observed behavior
The formula returns 1.8114 when the user expects 1.7410 for a date on or before September 30, 2021.
Before you start

Check that the lookup date in A2 and the dates in H2:H6 are real spreadsheet dates, not text. Confirm whether each table date is an upper cutoff or the start of an index period; this determines the match direction.

Solution 1Recommended

Use XLOOKUP to Match the Next Date Cutoff

Use this method when each date in column H is the last date covered by its corresponding index.

1
Check the lookup table

In columns H and I, verify that each cutoff date is on the same row as its index. For the example, September 30, 2021 should be paired with 1.7410.

2
Enter the formula

Select the result cell and enter =XLOOKUP(A2,$H$2:$H$6,$I$2:$I$6,"",1). The final argument returns an exact match or the next larger cutoff.

3
Test the result

Enter September 30, 2021 or an earlier date in A2 and check that the result is 1.7410, provided September 30 is the first applicable cutoff. Test a date after the final cutoff as well; the formula returns a blank when no larger cutoff exists.

4
Apply the formula to other rows

Drag the result cell's fill handle down. The reference to A2 changes by row, while the dollar signs keep the lookup ranges fixed.

Use XLOOKUP to Match the Next Date Cutoff
If dates mark the start of each period: Use match mode -1 instead of 1 to find the exact date or the next smaller date: =XLOOKUP(A2,$H$2:$H$6,$I$2:$I$6,"",-1). This returns a blank for a date before the earliest start date.
WPS Spreadsheet

Look Up an Index by Date in WPS Spreadsheet

Use INDEX and MATCH in WPS Spreadsheet to return the index associated with an entered date and a table of upper date cutoffs.

  1. 1. Open the workbook: Open WPS Spreadsheet and select Open to load your Excel workbook.
  2. 2. Sort the cutoff table: Select H2:I6 and use Data > Sort to sort the dates in column H from newest to oldest, keeping the index values with their dates.
  3. 3. Enter the formula: In the result cell, enter =IFERROR(INDEX($I$2:$I$6,MATCH(A2,$H$2:$H$6,-1)),""). Adjust the ranges if your table is in different cells.
  4. 4. Test the lookup: Enter a date in A2 and verify the returned index against the first cutoff on or after that date. A date later than every cutoff returns a blank.
Find an index using an exact date or the next larger cutoffOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet functions and sorting controls
microsoft office alternative - wps office

Frequently Asked Questions

Why does my date lookup return the wrong index?

The formula may be matching in the wrong direction, or a date may be stored as text. Check whether column H contains upper cutoffs or period start dates, and verify the dates in A2 and H2:H6 are real date values.

Does XLOOKUP require the dates to be sorted?

No. The XLOOKUP formula shown uses the default linear search and does not require sorting. Sorting can still make the table easier to inspect. The INDEX and MATCH alternative with match type -1 does require dates in descending order.

What happens if the entered date is after every cutoff?

With XLOOKUP match mode 1, there is no exact or larger cutoff, so the formula's empty-string argument returns a blank. Add a later cutoff if that date should have an index.

What if Excel uses semicolons in formulas?

Replace argument commas with semicolons, for example: =XLOOKUP(A2;$H$2:$H$6;$I$2:$I$6;"";1). Use the localized function name if your Excel language requires it.