Consulting

Results 1 to 3 of 3

Thread: Datedif (FULL MONTH)

  1. #1

    Datedif (FULL MONTH)

    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

  2. #2
    VBAX Regular GreenDR's Avatar
    Joined
    Oct 2012
    Location
    India
    Posts
    25
    Location
    DateAdd("m", -1, Now)
    GreenDR

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •