Formula Errors

Return the Header for the Last Numeric Value in an Excel Row

Olivia MillerOlivia Miller Nov 18, 2026 870 views

Question details

Find the last numeric value in L19:AZ19 and return its corresponding month header from L2:AZ2.

Return the Header for the Last Numeric Value in an Excel Row
Product
Microsoft Excel
Device & OS
not provided
Scenario
A row contains numeric values, blanks, or other entries, and the final numeric value may also appear earlier in the row.
Observed behavior
The desired result is the header above the rightmost numeric cell, rather than the header above an earlier duplicate value.
Before you start

Check that the month headers in L2:AZ2 align with the values in L19:AZ19. Choose an empty cell outside those ranges for the result.

Solution 1Recommended

Use INDEX to Return the Header by Column Position

Use this formula to find the rightmost numeric cell by position, so duplicate values do not affect the result.

ISNUMBER identifies numeric cells, and LARGE returns the rightmost matching position. INDEX then returns the header at that position.

1
Enter the formula

Select an empty result cell and enter =IFERROR(INDEX($L$2:$AZ$2,LARGE(IF(ISNUMBER($L19:$AZ19),COLUMN($L$1:$AZ$1)-COLUMN($L$1)+1),1)),"").

2
Confirm the formula

Press Enter in a current version of Excel. In older versions without dynamic arrays, press Ctrl+Shift+Enter to confirm it as an array formula.

3
Check the result

Compare the returned header with the rightmost numeric cell in L19:AZ19. If there are no numeric cells, the formula returns a blank.

Use INDEX to Return the Header by Column Position
Numbers and dates: Zero counts as a number. Excel dates are stored as numbers and also count; numeric-looking text does not.
Work with spreadsheet formulas in WPS

Find the Last Numeric Value's Header in WPS Spreadsheets

Use the same position-based INDEX formula in WPS Spreadsheets to return the month header above the rightmost numeric value, including a duplicated value.

  1. 1. Open the workbook: Open WPS Spreadsheets and select Open to load your Excel workbook.
  2. 2. Select a result cell: Click an empty cell outside L19:AZ19 and L2:AZ2.
  3. 3. Enter the formula: Type =IFERROR(INDEX($L$2:$AZ$2,LARGE(IF(ISNUMBER($L19:$AZ19),COLUMN($L$1:$AZ$1)-COLUMN($L$1)+1),1)),"") in the cell or formula bar.
  4. 4. Confirm and check: Confirm the formula with Ctrl+Shift+Enter, then check that the result matches the header above the rightmost numeric cell.
Finds the rightmost numeric value without matching an earlier duplicateOpens and saves Microsoft Excel XLSX filesUses familiar spreadsheet formulas and controlsAvailable as part of free WPS Office
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula return the correct header when a number is duplicated?

It finds the rightmost numeric column position with LARGE and uses that position in INDEX, rather than searching for the numeric value again.

What happens if the row contains no numbers?

The IFERROR wrapper returns a blank. Without it, the formula would return an error because there is no numeric position to find.

Does the formula count zero or a date as a numeric value?

Yes. ISNUMBER counts zero and Excel dates because dates are stored as numbers. It does not count numbers stored as text.

How do I use the formula for another row?

Copy the result cell down to another row. The row reference in $L19:$AZ19 changes, while the fixed header range $L$2:$AZ$2 stays the same.