Forum Discussion
leochan2003
Oct 07, 2020Copper Contributor
How to write a formula to sum cells with certain criteria?
Dear all,
I would like to sum cells that are not blank to fulfill the following criteria:
1. when the sum range is blank, then blank
2. when the sum range equals to zero, then 0
Your help would be very much appreciated.
If you want to sum the range say A2:A10, you may try something like this...
=IF(COUNTA(A2:A10)=0,"",SUM(A2:A10))
4 Replies
- Rajesh_SinhaIron Contributor
leochan2003 ,,,
You may use either of these:
=IF(NOT(COUNTA(A1:A10)),"",SUM(A1:A10))
{=IF(ISBLANK(A1:A10),"",IF(A1:A10=0, 0,SUM(A1:A10)))}
Note: Second formula is as array (CSE) formula, so finish it with Ctrl+Shift+Enter.
How it works:
- If All cells in range A1:A10 are BLANK then returns blank.
- If All cells in Range A1:A10 has ZERO then returns zero.
Otherwise gets the SUM.
- Subodh_Tiwari_sktneerSilver Contributor
If you want to sum the range say A2:A10, you may try something like this...
=IF(COUNTA(A2:A10)=0,"",SUM(A2:A10))
- leochan2003Copper Contributor
Thank you so much.
Subodh_Tiwari_sktneer- Subodh_Tiwari_sktneerSilver Contributor
You're welcome leochan2003!