FormulaCraft

How to return the column header of a matching value in Excel and Google Sheets

Excel & Google Sheets
=INDEX($A$1:$D$1,MATCH(E2,$A$2:$D$2,0))

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Ensure your table has headers in row 1 and data in subsequent rows.
  2. 2Put the value you want to locate in a cell (e.g. E2).
  3. 3Enter =INDEX($A$1:$D$1,MATCH(E2,$A$2:$D$2,0)).
  4. 4MATCH finds the column position of E2 in the data row; INDEX returns the header from row 1 at that position.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

How do I return the column header for a value anywhere in a table (not just one row)?

Wrap in an array formula and use MATCH on a concatenated or flattened version of the table, or search row-by-row with helper columns.

What if the headers are in a column (row headers) rather than a row?

Switch the INDEX range to a column and adjust MATCH to search within the relevant column: =INDEX($A$1:$A$5,MATCH(E2,$B$1:$B$5,0)).

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: