Search code examples
excelexcel-formulaexcel-indirect

How to use INDIRECT in the condition of SUMIF?


The first column of my worksheet contains some categories (e.g. A1: Food). I'd now like to use these typed words in the condition of a SUMIF in the second column (e.g. B1: =SUMIF(C1;"Food";D1). However, I don't want to retype them again.

Is it possible to use INDIRECT in this case? I tried =SUMIF(C1;INDIRECT(A1);D1), but that didn't work, although I don't get an error message.


Solution

  • For the sake of an answer:

    For that you shouldn't need Indirect, if you're trying to sum for each value that is "Food", it should just be:

     =SUMIF(C1;A1;D1)  
    

    Courtesy John Bustos.