Forum Discussion

CamReid's avatar
CamReid
Copper Contributor
Jun 16, 2023
Solved

How to SUM only IF TRUE?

I feel like there should be an easier way to do this. Please help 🙂   =IF(O5,SUM(L5),0)+IF(O6,SUM(L6),0)+IF(O7,SUM(L7),0)+IF(O8,SUM(L8),0)+IF(O9,SUM(L9),0)+IF(O10,SUM(L10),0)+IF(O11,SUM(L11),0)+IF...
  • SnowMan55's avatar
    Jun 17, 2023

    CamReid If your column O contains all Boolean values (TRUE/FALSE), then this will suffice:

    =SUM( L5:L20 * O5:O20 )

    If your column O contains all numbers that are to be implicitly interpreted as Boolean values, then:

    =SUMIF( O5:O20, "<>0", L5:L20 )

    (The spaces are not required, but are included for readability.)

     

    Note that for column O, empty cells and cells containing #N/A or an error value may not be handled as you expect.

     

     

Resources