SOLVED

Formula to select relevant heading based on 2 conditions

Copper Contributor

Trying to select the relevant heading an array.  Effectively, return first heading where there is either an "x" or "z".  So in the example below would return 4H

 

2H4H8H1D2D1W
abx   
ab xx 
az  xx
   c  
3 Replies
best response confirmed by JohnDatacom (Copper Contributor)
Solution

@JohnDatacom There's likely more than one way to achieve this. If you have Excel for MS365, here's one option:

 

=TAKE(TOCOL(IFS((A2:F5="x")+(A2:F5="z"), A1:F1), 2, TRUE), 1)

 

match_by_column.png

@JohnDatacom 

 

Hi,

 

You can use =OR(ISNUMBER(MATCH("x",A2:A5,0)),ISNUMBER(MATCH("z",A2:A5,0))) to check whether or not the column has "x" or "z".

Then you can use INDEX and MATCH to find out the heading of the first column that satisfies this condition.

 

@djclements thank you that worked perfectly.  Appreciated

1 best response

Accepted Solutions
best response confirmed by JohnDatacom (Copper Contributor)
Solution

@JohnDatacom There's likely more than one way to achieve this. If you have Excel for MS365, here's one option:

 

=TAKE(TOCOL(IFS((A2:F5="x")+(A2:F5="z"), A1:F1), 2, TRUE), 1)

 

match_by_column.png

View solution in original post