Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# Display Column First Row Header when Matched

Posted on 2014-07-18
Medium Priority
210 Views
Hello Experts,

I need an Excel 2010 formula that will display the first header row when a match is found within an array based on a value:

Value        Result from first row
Oakland = City
Bob = Name

ID   Name  City
1      Joe      Houston
2      Bob     New York
3      Jill        Oakland
0
• 3
• 2

LVL 27

Expert Comment

ID: 40205713
I'm going to re-state your question; please confirm that this is correct.

A table exists with data.  A user enters an arbitrary value.  A formula is desired that will identify the type of information as listed in a header row of the table.

For example, if a table contains three columns of data, with the header row containing:
A1:  "ID"
B1: "Name"
C1: "City"

with values below being:
A2: 1
B2: "Joe"
C2: "Houston"
A3: 2
B3: "Bob"
C3: "New York"
A4: 3
B4: "Jill"
C4: "Oakland"

and the user enters the value "Oakland" in a cell, the formula will return the value "City"
Likewise, if the user enters the value "Bob", the formula will return the value "Name"

1) What if a value occurs in more than one column?  For example, "Austin" could be a person's name or the name of a city.
2) What do you want to see if there is no match?

-Glenn
0

Author Comment

ID: 40205742
Yes, that's right

1) What if a value occurs in more than one column?  For example, "Austin" could be a person's name or the name of a city.

Just the first it encounters it fine

2) What do you want to see if there is no match?

N/A..zero...no match found...doesn't really matter to me
0

Author Comment

ID: 40205904
this is close but only works if I specify a specific row and I need this to work for an array:

=INDEX(\$A\$1:\$E\$1,1, MATCH(1,\$A2:\$E2,0))
0

LVL 27

Expert Comment

ID: 40206519

I'm close to a solution, but am trying to avoid either nested IF statements (an approach seen here in EE) or a helper row.  Both cases work (I have a workbook with both types), but am trying to see if I can use an array function instead.

-Glenn
0

LVL 27

Accepted Solution

Glenn Ray earned 2000 total points
ID: 40230153

Sorry for the long delay in getting a solution to you, but I did figure it out.  Assuming the value to search for is in G2, the formula to return the header row lable (field name) would be:

This is only searching down to row 20; you'd want to change that value accordingly.  Example workbook attached.

-Glenn
EE-IdentifyColumn.xlsx
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
###### Suggested Courses
Course of the Month13 days, 23 hours left to enroll