# How can I make a cell that's a number format not show a zero?

I am using the following formula in all my first hundred rows for column F:

``````=(E5-D5)*1440
``````

This is used to calculate the time in minutes between the cells in column E and column D. I have this formula applied to every row. The formula works however I have rows where the E and D columns are empty. For these Excel displays a 0 in column f.

Is there a way I can make a number format show nothing if the value of the cell is zero? Note that I still want to keep this as a number formatted cell as later on I sum up all the values in column f and use that in another part of the spreadsheet.

-

## migrated from stackoverflow.comJan 18 '13 at 13:17

This question came from our site for professional and enthusiast programmers.

Yes, with a custom format like this:

``````0;-0;
``````

The pattern for a zero is the 3rd argument (which in your case is blank), to show for example an `x` in place of zero, use this:

``````0;-0;x
``````
-

If there are circumstances where zero is a legitimate result (for example when E5 and D5 are not blank but E5 = D5) then rather than format to show zero as blank you could alter the formula to return a blank, e.g.

`=IF(COUNT(D5,E5)=2,(E5-D5)*1440,"")`

That will return a blank unless both D5 and E5 are numeric (e.g. time values)

You can still use SUM function on the results, blanks will be ignored

-

Try NOT(ISBLANK(E5)) and NOT(ISBLANK(D5))

-

Try =if(((E5-D5)*1440)=0," ",((E5-D5)*1440))

-