Thread: format cell
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld
 
Posts: n/a
Default format cell

On Mon, 23 Jan 2006 03:51:02 -0800, "hans"
wrote:

I have a cell A1 in which I want to print a date dd-mm-yy. This cell is
depending on another cell B1 . In this cell I calculate the number of days by
distracting one date from another. If the number of days is positive A1
should read a date dd-mm-yy, if the number of days is negative A1 should read
0.
A1 gives me 0-1-1900
How can I get 0 in A1 ?


The problem is that A1 is formatted as "date". Therefore when the value is 0,
you will see the result you get.

Try this custom format instead:

Format/Cells/Number/Custom Type: [0]m/d/yyyy;[<0]\0;0

With this format, you won't even need to test for negative values in your
formula in A1.


--ron