Function Problems

Excel: Look Up Row Values and Return Column Headers

Steve KSteve K Nov 18, 2026 868 views

Question details

Find specified values in a worksheet row and return their corresponding column headers without using VBA.

Look Up Row Values and Return Column Headers in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet has headers in row 1 and values such as V and H in row 2. The user wants to identify the header above each value.
Observed behavior
Each lookup should return the header above the first matching value in the row.
Before you start

Identify the header range and the row to search. For the examples below, headers are in D1:V1 and the values to search are in D2:V2; both ranges must cover the same columns.

Solution 1Recommended

Use INDEX and MATCH to return the matching header

Use this formula to return the header above the first exact match for a value in a row.

MATCH finds the position of the target within D2:V2, and INDEX returns the header at the same position in D1:V1. Both functions are nonvolatile, unlike OFFSET.

1
Look up the first value

Select an empty cell such as B2 and enter =INDEX($D$1:$V$1,1,MATCH("V",D2:V2,0)). Press Enter to return the header above the first V.

2
Look up another value

In another empty cell, such as C2, enter =INDEX($D$1:$V$1,1,MATCH("H",D2:V2,0)) and press Enter to return the header above the first H.

3
Use a cell as the target

To change the lookup value without editing the formula, type the target in A2 and replace "V" with A2: =INDEX($D$1:$V$1,1,MATCH(A2,D2:V2,0)).

4
Handle missing values

To show a message instead of an #N/A error when there is no match, enter =IFERROR(INDEX($D$1:$V$1,1,MATCH(A2,D2:V2,0)),"Not found").

Use INDEX and MATCH to return the matching header
First match only: MATCH returns the first matching position from left to right. Use a separate formula for each target value.
Find headers without VBA

Return Matching Column Headers in WPS Spreadsheet

Use INDEX and MATCH in WPS Spreadsheet to find a value in a row and return the header from the same column.

  1. 1. Open the workbook: Open WPS Spreadsheet and select Open to load your Excel workbook.
  2. 2. Check the ranges: Find the header row and the row containing your values. For example, use D1:V1 for headers and D2:V2 for values.
  3. 3. Enter the formula: Select an empty cell and enter =INDEX($D$1:$V$1,1,MATCH("V",D2:V2,0)), then press Enter.
  4. 4. Look up other values: Enter a separate formula in another empty cell, replacing "V" with "H" or a cell reference containing your target.
Find the header for a row value without VBAUse a cell reference to change the lookup targetOpen and edit Microsoft Excel XLS and XLSX filesUse familiar spreadsheet formulas and a free office suite
microsoft office alternative - wps office

Frequently Asked Questions

What happens if the value appears more than once?

MATCH with a final argument of 0 returns the first exact match from left to right, so the formula returns the header above that occurrence.

Why does the formula return #N/A?

The target was not found in the specified row. Check the value and range, or wrap the formula in IFERROR to display a message such as "Not found".

Can I change the lookup value without editing the formula?

Yes. Enter the target in A2 and use =INDEX($D$1:$V$1,1,MATCH(A2,D2:V2,0)). Change A2 to look up a different value.

Can I copy the formula down for other rows?

Yes. Copy the formula down with the fill handle. The locked header range $D$1:$V$1 stays fixed, while D2:V2 changes to the next row.