PDA

View Full Version : Datedif (FULL MONTH)



wrightyrx7
11-07-2012, 08:16 AM
Hi all,

Trying to get a datedif formula to work.

a simple

=DATEDIF(A1,A2,"m")

if i put
A1 = 01/01/2012
A2 = 01/02/2012

This will return 1 month

if i put
A1 = 01/01/2012
A2 = 31/01/2012

This will return 0 months

For my purposes the 01/01/2012 and 31/01/2012 days are included. So all 31 days of January are accounted for. I would expect the formula to sat 1 month. Is there anything i can add to the formula to work the way i want it to?

Thanks in advance
Chris

GreenDR
11-07-2012, 10:04 AM
DateAdd("m", -1, Now)

xld
11-07-2012, 11:40 AM
DateDif counts the difference in whole monthst, so two dates in Jan is no differnece. You could try

=DATEDIF(A1,A2+1,"M")

but be aware that DATEDIF has some nasty bugs.