May 23 2022 03:30 PM - edited May 23 2022 03:30 PM
Hi,
I would like to evaluate a SUMIFS formula so that if it produces a result greater than 0, it should print that value, and if it produces 0, it should instead be an empty field.
What I've currently got is =IF(SUMIFS(...)>0,SUMIFS(...),"") where SUMIFS(...) is short for the full formula.
It works exactly how I want it to, but it seems inefficient to write it twice in an IF formula like that, and then if I ever want to change the criteria I have to do it twice in the same place.
Any suggestions please?
Cheers!
May 23 2022 03:40 PM
If you keep the original =SUMIFS(...) formula, you have two options:
May 23 2022 04:29 PM
Solution
Assuming you have the most recent version of Excel, you could employ the LET function to avoid the redundancy you speak of. Here's a reference.https://exceljet.net/excel-functions/excel-let-function
Given the formula you've shared, =IF(SUMIFS(...)>0,SUMIFS(...),""),
LET would enable you to write something along these lines:
=LET(res,SUMIFS(...),IF(res>0,res,""))
May 23 2022 06:16 PM - edited May 23 2022 06:18 PM
Just a note to go with @Hans Vogelaar solution, if a negative number is possible then change the formula to =MAX( SUMIFS(...), 0)
and apply either of the bullet points to make the 0 values blank
but if you have Excel 365 I recommend the LET() command mentioned by @mathetes
May 25 2022 08:16 AM
May 23 2022 04:29 PM
Solution
Assuming you have the most recent version of Excel, you could employ the LET function to avoid the redundancy you speak of. Here's a reference.https://exceljet.net/excel-functions/excel-let-function
Given the formula you've shared, =IF(SUMIFS(...)>0,SUMIFS(...),""),
LET would enable you to write something along these lines:
=LET(res,SUMIFS(...),IF(res>0,res,""))