Find cell "X" and return Header

Pestomania

Active Member
Joined
May 30, 2018
Messages
332
Office Version
  1. 365
Platform
  1. Windows
I am trying to identify whenever a column has an "X" in it. I have this formula which returns the first column with a "number". I tried using ISTEXT("X") and the Match("X") formulas but all are returning the incorrect column for cell = "X".

Can you please see what I might be doing wrong:

This one provides the correct column name, if there is any number value.
VBA Code:
=INDEX($AU$3:$GT$3,AGGREGATE(15,6,(COLUMN(AU5:GT5)-COLUMN(AU5)+1)/(ISNUMBER(AU5:GT5)*(AU5:GT5>0)),1))

This returns the correct column if cell <>"0".
Code:
=INDEX($AU$3:$GT$3,AGGREGATE(15,6,(COLUMN(AU5:GT5)-COLUMN(AU5)+1)/(ISTEXT("X")*(AU5:GT5>0)),1))

But I need it to return the column for the cell that equals "X"/.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
How about
Excel Formula:
=INDEX($AU$3:$GT$3,AGGREGATE(15,6,(COLUMN(AU5:GT5)-COLUMN(AU5)+1)/(AU5:GT5="X"),1))
 
Upvote 0
Another option as you have 365 is
Excel Formula:
=take(filter($AU$3:$GT$3,AU5:GT5="X"),,1)
 
Upvote 0
Solution
Another option as you have 365 is
Excel Formula:
=take(filter($AU$3:$GT$3,AU5:GT5="X"),,1)
You are awesome!!

Thanks for the quick response too. I guess I was making it more difficult then it needed to be.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top