Michi
Michi

Reputation: 5481

Get the column number of a search criteria in a defined range

I have the following Excel spreadsheet:

   A      B                  C          D       E       F      G       H    
1     Search Criteria:    Prod.D
2     Column:               4
3                                   Prod.A   Prod.B  Prod.C  Prod.D   Prod.E
4                      
5      

In Range D3:H4 I have Product A to Product E listed.
Now, I want to achieve that when I put a product name into Cell C1 I will get back the Column Number of the product in the range.

In the example above I want to search for Prod.D within the Range D3:H4 and therefore the result in Cell C2 should be 4 since the search criteria appears in the fourth column within the defined range.

What formula do I need to achieve this?

Upvotes: 0

Views: 28

Answers (1)

riskypenguin
riskypenguin

Reputation: 2199

Try this formula in cell C2:

=MATCH(C1,D3:H3,0)

Upvotes: 1

Related Questions