Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Subtracting dates from two columns

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Subtracting dates from two columns

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

"Shannan" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Subtracting dates from two columns

See this:

http://www.cpearson.com/Excel/datedif.aspx

--
Biff
Microsoft Excel MVP


"Shannan" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Subtracting dates from two columns

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

where Y15 is the earlier date.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Shannan" wrote:

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

"Shannan" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Subtracting dates from two columns

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?

"Luke M" wrote:

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

where Y15 is the earlier date.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Shannan" wrote:

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

"Shannan" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,104
Default Subtracting dates from two columns

=IF(COUNT(Y15,AD15)<2,"",IF(DATEDIF(Y15,AD15,"m") =0,"",DATEDIF(Y15,AD15,"m"))
)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Shannan" wrote in message
...
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?

"Luke M" wrote:

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

where Y15 is the earlier date.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Shannan" wrote:

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

"Shannan" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtracting Dates Terry Bennett Excel Worksheet Functions 7 November 17th 07 11:38 AM
Subtracting Dates Malik Excel Discussion (Misc queries) 4 October 1st 07 10:44 AM
Subtracting dates toot033 Excel Discussion (Misc queries) 3 July 17th 06 09:03 PM
Subtracting dates? Bill R Excel Worksheet Functions 1 August 15th 05 05:37 AM
Subtracting dates: 8/31/05-8/1/05? dstock Excel Discussion (Misc queries) 1 July 26th 05 04:04 PM


All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"