Excel: Look Up Row Values and Return Column Headers
Question details
Find specified values in a worksheet row and return their corresponding column headers without using VBA.

- 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.
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.
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.
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.
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.
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)).
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").

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. Open the workbook: Open WPS Spreadsheet and select Open to load your Excel workbook.
- 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. Enter the formula: Select an empty cell and enter =INDEX($D$1:$V$1,1,MATCH("V",D2:V2,0)), then press Enter.
- 4. Look up other values: Enter a separate formula in another empty cell, replacing "V" with "H" or a cell reference containing your target.

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.




