View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default return 0 if cell has data?

"kathysonisland" wrote:
I need a formula to display 0 in a cell if another cell has a date.


Is the following sufficient?

=if(isnumber(A1), 0, "")

That returns zero if A1 ("the other cell") has a number, which includes a
date. Otherwise, it returns the null string, leaving the cell appear blank.

If you truly need to distinguish between a date and other numbers, I think
you need to write a UDF (VBA function). Is that necessary?

Also, I ass-u-me that "the other cell" contains a numeric date, not text
that looks like a date. In other words, TYPE(A1) is 1, not 2.