SOLVED

HOW TO: "If cell contains a specific value, display name of the column in which value is present"?

%3CLINGO-SUB%20id%3D%22lingo-sub-2628099%22%20slang%3D%22en-US%22%3EHOW%20TO%3A%20%22If%20cell%20contains%20a%20specific%20value%2C%20display%20name%20of%20the%20column%20in%20which%20value%20is%20present%22%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2628099%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20write%20a%20code%20that%20finds%20a%20value%20in%20a%20row%20and%20displays%20the%20name%20of%20the%20column%20in%20which%20the%20value%20is%20present.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efor%20example%3A%20the%20output%20should%20display%20the%20column%20name%20where%20%22Y%22%20is%20present%20in%20the%20selected%20row.%3C%2FP%3E%3CP%3ELet's%20consider%20the%20second%20row%2C%20the%20output%20should%20be%20LPH.art%20(i.e.%20column%20where%20Y%20is%20present)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20width%3D%22755px%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2282.8958px%22%3ELPH%26nbsp%3B%3C%2FTD%3E%3CTD%20width%3D%2298.875px%22%3ELPH.T%3C%2FTD%3E%3CTD%20width%3D%22150.708px%22%3ELPH%20%2B%20SD%3C%2FTD%3E%3CTD%20width%3D%22120.854px%22%3ELPH.art%3C%2FTD%3E%3CTD%20width%3D%2274.9062px%22%3EOR%3C%2FTD%3E%3CTD%20width%3D%22107.865px%22%3EOR.art%3C%2FTD%3E%3CTD%20width%3D%22117.896px%22%3E%3CSTRONG%3EOutput%3C%2FSTRONG%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20width%3D%2282.8958px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%2298.875px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22150.708px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22120.854px%22%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3EY%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%3CTD%20width%3D%2274.9062px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22107.865px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22117.896px%22%3E%3CSTRONG%3ELPH.art%3C%2FSTRONG%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20width%3D%2282.8958px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%2298.875px%22%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3EY%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%3CTD%20width%3D%22150.708px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22120.854px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%2274.9062px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22107.865px%22%3EN%3C%2FTD%3E%3CTD%20width%3D%22117.896px%22%3E%3CSTRONG%3ELPH.T%3C%2FSTRONG%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20the%20help!%3C%2FP%3E%3CP%3EBest%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2628099%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2628225%22%20slang%3D%22en-US%22%3ERe%3A%20HOW%20TO%3A%20%22If%20cell%20contains%20a%20specific%20value%2C%20display%20name%20of%20the%20column%20in%20which%20value%20is%20pr%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2628225%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1124114%22%20target%3D%22_blank%22%3E%40lucadefre%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20option%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DINDEX(A%241%3AF%241%2CMATCH(%22Y%22%2C%24A%242%3A%24F%242%2C0))%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi all, 

 

I am trying to write a code that finds a value in a row and displays the name of the column in which the value is present.

 

for example: the output should display the column name where "Y" is present in the selected row.

Let's consider the second row, the output should be LPH.art (i.e. column where Y is present)

 

LPH LPH.TLPH + SDLPH.artOROR.artOutput
NNNYNNLPH.art
NYNNNNLPH.T

 

Thank you for the help!

Best, 

 

2 Replies
best response confirmed by lucadefre (New Contributor)
Solution

@lucadefre 

One option:

=INDEX(A$1:F$1,MATCH("Y",$A$2:$F$2,0))