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)`

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)
```

### Answer：

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"))
```

Tags: excelexcel