Forum Discussion
CamReid
Jun 16, 2023Copper Contributor
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...
- 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.
SnowMan55
Jun 17, 2023Bronze Contributor
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.