How to IF function to return date if True, 0 if False

L

Laura M.

I am working on a spreadsheet where I need to determine
the number of days from Date1 to Date2. If there is not a
Date2, I want Excel to return a value of 0. Does anyone
know how to do this?
 
E

Earl Kiosterud

Laura,

=IF(Date2<>"", Date2-Date1, 0)

Format for ordinary numbers (not date), like General. Substitute your date
cells for Date1 and Date2.
 
J

Jack

Hello Laura,

Try the following.
If Date1 is in cell A1 and Date2 is in cell B1 then the
 
Top