Subtracting dates from two columns

S

Shannan

Hi,
I am trying to find a formula that will subtract the dates from two columns
and give me the difference in months. I had " =MONTH(AD15)-MONTH(Y15)", but
i've just realized that if one date is 2007-09-08 and the other is
2006-11-27, then the formula i was using does not account for the years being
different and gives me an answer of -2. How do i account for the years?
Thanks.

Shannan
 
S

Shannan

I forgot to mention that if the difference is 0, i would like the cell to
remain blank instead of showing the 0.
 
L

Luke M

=IF(DATEDIF(Y15,AD15,"m")=0,"",DATEDIF(Y15,AD15,"m"))

where Y15 is the earlier date.
 
S

Shannan

Hi,
this only works until i end up with one of the date cells being blank. Then
this formula gives me a "#NUM!" error. Is there a way around this?
 
B

Bernard Liengme

=IF(COUNT(Y15,AD15)<>2,"",IF(DATEDIF(Y15,AD15,"m")=0,"",DATEDIF(Y15,AD15,"m"))
)
best wishes
 

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