date diff funtion

M

MKoonce

I am trying to take a birthday and entry date into our program and find out
the month. For example

Jane doe birthday is 11/1/08 and she enrolled 6/1/09. how do i find the age
in months at the time she enrolled?? what would be my formula? I have tried
several but I think I am missing a piece to it.
 
D

Douglas J. Steele

=DateDiff("m", [DOB], [EnrollDate]) - IIf(Format([EnrollDate], "dd") <
Format([DOB], "dd"), 1, 0)

DateDiff works by reporting "boundary crossings". If DOB is 31 May, 2009 and
EnrollDate is 1 June, 2009, that will be treated as 1, since you crossed
from one month to another. By comparing the days, you can reduce that count
by one unless a full month has transpired.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top