excelif-statement

Excel IF multiple columns


I'm working with a large Excel questionnaire that I would like to simplify the data output for further evaluation.

enter image description here

What I'm trying to make is an IF statement, so that if the X is in fueloil the P column will write Fueloil etc..

=IF(K2="X";K1)

However when I'm trying to add another IF statement, Excel returns VALUE. is IF the right way to go about this or is there another way of doing this?


Solution

  • You don't need IF for this at all. You can use an Index/Match combo formula as demonstrated in the screenshot below. The formula in cell P2 is copied down.

    =INDEX($K$1:$O$1,MATCH("x",K2:O2,0))
    

    In words: Find the "x" in the current row and return the value from row 1 of that column.

    If your regional settings require semicolons to separate parameters in formulas, please use

    =INDEX($K$1:$O$1;MATCH("x";K2:O2;0))
    

    enter image description here