Reputation: 11
Trying to discount zero value in Excel.
My formula is =SUM(U19+X19)/2
however if either U19
or X19
contain a value of zero I want the formula to be
=SUM(U19+X19)/1
or =SUM(U19+X19)
Upvotes: 1
Views: 125
Reputation: 169364
You could use COUNTIF. You would need to call it twice since it does not accept disjoint cells.
=(U19 + X19) / (COUNTIF(U19,"<>0") + COUNTIF(X19,"<>0"))
Upvotes: 0
Reputation: 952
How about:
=IF(U19*X19=0, SUM(U19+X19), SUM(U19+X19)/2)
or more simple:
=IF(U19*X19=0, U19+X19, (U19+X19)/2)
Upvotes: 3