proper syntax order

  • Thread starter Roberta H via OfficeKB.com
  • Start date
R

Roberta H via OfficeKB.com

Hello all, I have three fields

"ReceivedDate"
"Date"
"Total Days"

The first two are date fields, the second I want to either count the number
of days between the dates or if no "Date" than "Total Days" would should "0".


"Date" - "ReceivedDate" = "Total Days"
2/6/06 - 1/12/06 = 25
This works - if that's all I needed, however,

"Date" - "ReceivedDate" = "TotalDays", If "Date" is blank, then "TotalDays" =
0
I can't get the right order to make this simple formula work.
Please help.
Thank you.
 
S

SteveG

Roberta,

Assuming A1= "Date", B1 = "Received Date" & C1 = "Total Days" then in
C2 enter:

=IF(ISBLANK(A2),0,DATEDIF(B2,A2,"d"))

HTH

Steve
 
R

Roberta H via OfficeKB.com

Thank you so very much Steve!
Yes it works great! One problem I had, however, was getting an accurate
count from the very date received to the "date", so I made a very small
modification to the formula:
=IF(ISBLANK(H191),0,DATEDIF(G191-1,H191,"d")).

**************************************
 
Top