Full Version: Dateif - Count Days Between Two Dates
UtterAccess Discussion Forums > Microsoft® Office > Microsoft Excel
rjAccDB

Hello UA,

Am trying to use this formula/function: =DateIf(a1,b1, "D") to count the days between A1 - B1.. there are instances that it gives the correct count, and there are instances that it is less than 1 to the actual count.. (usage is to count the days of vacation leave for an employee - so count start from the first day to the last day of leave.. i.e. "01-Apr-12 to 30-Apr-12 = 30 days..

Can someone please help me on this..

Many thanks,
rj
Jeff B.
Are you measuring/recording physical dates, or date/time values? Would you consider someone who took 4 hours of leave as having taken "1 day"?
rjAccDB
Hello Jeff,

Yes a physical date,.. ie a leave from 14-Apr-12 to 30-Apr-12 = 17 days (this includes Sat & Sun..).

Many thans,
rj
Jeff B.
Not sure I saw your answer to my secondary question ... are you only considering "whole" days off?
dflak
It seems like this formula should work: =INT(B2) - INT(A2) + 1 where A2 is the start date and B2 is the end date. The INTs wrapped around the dates assures we're dealing with whole days and don't suffer the loss or gain of a day due to rounding.
rjAccDB
Hi Jeff,

Sorry,..I overlooked your other question..

Yes, we only consider here "whole" day, as we count days not hours..

Hope I satisfied your question.

Thanks,
rj
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.