How to get or return column header based on specific row value in Excel? (2024)

How to get or return column header based on specific row value in Excel?

In this tutorial, we will search for a specific value in rows of a data range, and then, return the corresponding column header of the matching row cell.

How to get or return column header based on specific row value in Excel? (1)

Get column header based on specific row value with formula

Get column header based on specific row value with formula

For getting the column header based on specific row value in Excel, the below formula can help you.

1. Select a blank cell to output the header, copy the below formula into it and press the Enter key to get the corresponding header.

=INDEX($C$2:$G$2,SUMPRODUCT(MAX(($C$3:$G$6=I3)*(COLUMN($C$3:$G$6))))-COLUMN($C$2)+1)

How to get or return column header based on specific row value in Excel? (2)

Note: In the formula, $C$2:$G$2 is the header range, $C$3:$G$6 is the range contains the specific value in which you will searching for, I3 is the cell contain the criteria value you will match in range $C$3:$G$6, and $C$2 is the first column of range $C$3:$G$6. Please change them to your needs.

Related articles

Vlookup value and return true or false / yes or no in Excel
To vlookup values in a list, and display True / False or Yes / No for the result, the method in this article will do you a favor.

return value in another cell if a cell contains certain text in Excel
Supposing cell E6 contains value “Yes”, cell F6 will be automatically populated with value “approve”. If you have changed the “Yes” to “No” or “Neutrality” in E6, the value in F6 will be changed to “Deny” or “Reconsider” immediately. How can you do to achieve it? This article collects some useful methods to help you easily solve it.

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • Pivot Table Grouping by week number, day of week and more... Show Unlocked, Locked Cells by different colors; Highlight Cells That Have Formula/Name...

How to get or return column header based on specific row value in Excel? (3)

Read More... Full Features 30-Day Free Trial... Purchase...

Office Tab - brings tabbed interface to Office, and make your work much easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

How to get or return column header based on specific row value in Excel? (4)

Read More... Full Features 30-Day Free Trial... Purchase...

Sort comments by

Oldest First

Newest First

Comments (18)

Rated 4.5 out of 5·1 ratings

Raquel

#42813

This comment was minimized by the moderator on the site

Muito obrigada pelo conteúdo!!! Excelente!

Reply

Algendar

#41529

This comment was minimized by the moderator on the site

Muchas gracias por la información y el interés prestado!!
Saludos

Reply

Algendar

#41343

This comment was minimized by the moderator on the site

Muchas gracias por todo!!
Una pregunta: ¿Cómo puedo regresar los encabezados de una tabla en una misma celda?

Reply

Rated 4.5 out of 5

crystal Algendar

#41501

This comment was minimized by the moderator on the site

Hi Algendar,
Do you mean to search for multiple values and return matching headers in a single cell? If so, simply join the same formula containing different search values in one cell with the Ampersand symbol (&). See the screenshot below.
=INDEX($C$2:$G$2,SUMPRODUCT(MAX(($C$3:$G$6=I3)*(COLUMN($C$3:$G$6))))-COLUMN($C$2)+1) & " " & INDEX($C$2:$G$2,SUMPRODUCT(MAX(($C$3:$G$6=I4)*(COLUMN($C$3:$G$6))))-COLUMN($C$2)+1)
How to get or return column header based on specific row value in Excel? (6)

Jerry

#40469

This comment was minimized by the moderator on the site

So say that there will be entries where the values in I3 may not be found, for all of those cells it tries to output every column header in the range giving me a #ref error since it my sheet isnt long enough to accommodate all the titles again, is there any way for it to just output a blank cell in these cases?

Reply

crystal Jerry

#40574

This comment was minimized by the moderator on the site

Hi Jerry,
The following formula can do you a favor. Please give it a try.
=IFERROR(INDEX($C$2:$G$2,SUMPRODUCT(MAX(($C$3:$G$6=I3)*(COLUMN($C$3:$G$6))))-COLUMN($C$2)+1),"")

Reply

Report

Deepak

#39610

This comment was minimized by the moderator on the site

Hello,
If we have multiple I3 values will it give the second header which has the same value.
If there is anything to do so, please let me know.

Reply

crystal Deepak

#39709

This comment was minimized by the moderator on the site

Hi Deepak,
Can you attach a screenshot to describe the problem you encountered more clearly?

Reply

Report

Mono

#38762

This comment was minimized by the moderator on the site

Hello, what if we have missing values ? why does it return the last header ?
Can it be arranged so we don't fill the cell with anything in case it's missing ?

crystal Mono

#38818

This comment was minimized by the moderator on the site

Hi Mono,
The following formula may help. If no condition is specified, the result will be displayed as null even if there are missing values in the original range.
=IF(I3="", "", INDEX($C$2:$G$2,SUMPRODUCT(MAX(($C$3:$G$6=I3)*(COLUMN($C$3:$G$6))))-COLUMN($C$2)+1))

Reply

Report

Cyrous

#37267

This comment was minimized by the moderator on the site

How to modify this formula to return specific value if there's no match?

Reply

sam

#34841

This comment was minimized by the moderator on the site

Amazing. This is very helpful,I was wondering if the value matches more than one header, how to get all headers

Reply

Dan sam

#42766

This comment was minimized by the moderator on the site

Did you find a solution to this?

Reply

Sam

#34407

This comment was minimized by the moderator on the site

Hi. Awesome example. Any thoughts about if there are duplicate values?

Reply

Diogo Sam

#34408

This comment was minimized by the moderator on the site

Hey, were you able to find an answer to this problem ?
The formula here presented is working great for me except this particular matter of having duplicated valuesIs there a way to only take into account the first true value the formula encounters?

Reply

helo Diogo

#34409

This comment was minimized by the moderator on the site

hey, i don't know if there is a way, but something that may be of help is the =Unique command, which counts only the unique data (not replicates of the same data) Hope this helped or what you were looking for :)

Reply

Jim

#33412

This comment was minimized by the moderator on the site

Thank you for this. Very helpful :)

Reply

BreadLiker09092081 Jim

#33413

This comment was minimized by the moderator on the site

ur welcome

Reply

There are no comments posted here yet

Please leave your comments in English

Posting as Guest

How to get or return column header based on specific row value in Excel? (2024)
Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5554

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.