How do I create formula to calc difference in dates? in Excel General Questions  
 |  Edit my Profile  |  Help
 
     
  
 
 
 
dlcroswell 8/17/2006 3:49 PM PST
  Question
  I have a 'hire date' & a 'term date'. I need to calcuate the difference in
months & don't want to do the calculations manually. EX. 7/1/06 1/1/06 = 6
months
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
BigPig 8/17/2006 4:28 PM PST
  Answer
  dlcroswell,

If 7/1/06 is in cell a1, and 1/1/06 is in cell b2 then
in cell c1*
=MONTH(A1)-MONTH(B1)

*note, you may have to format cells to general or number

Hope this helps

---Bigpig---

"dlcroswell" wrote:

> I have a 'hire date' & a 'term date'. I need to calcuate the difference in
> months & don't want to do the calculations manually. EX. 7/1/06 1/1/06 = 6
> months
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Mike 12/30/2007 6:36 PM PST
   
  =MONTH(A1)-MONTH(B1)

That works when the two months are in the same year, but what if they are in
different years? For example January 2008-September 2007 = -8, but should
equal 4. Or December 2008-January 2006 = 11, but should equal 23.
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Ron Rosenfeld 12/30/2007 6:55 PM PST
   
  On Sun, 30 Dec 2007 18:37:01 -0800, Mike <Mike@discussions.microsoft.com>
wrote:

>=MONTH(A1)-MONTH(B1)
>
>That works when the two months are in the same year, but what if they are in
>different years? For example January 2008-September 2007 = -8, but should
>equal 4. Or December 2008-January 2006 = 11, but should equal 23.

Use the undocumented DATEDIF function:

=DATEDIF(B1,A1,"m")

(The first date must be the earlier date).


See http://www.cpearson.com/Excel/datedif.aspx for documentation.

--ron
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
David Biddulph 12/31/2007 2:19 AM PST
   
  I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)

An alternative to DATEDIF would be
=MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
Note that if you have different dates within the start and end months,
you'll get different results from the 2 formulae.
End of Jan to beginning of Feb gives a 1 month difference with the original
=MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
completed months (with various questions when months are of unequal length).
--
David Biddulph

"Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
> On Sun, 30 Dec 2007 18:37:01 -0800, Mike <Mike@discussions.microsoft.com>
> wrote:
>
>>=MONTH(A1)-MONTH(B1)
>>
>>That works when the two months are in the same year, but what if they are
>>in
>>different years? For example January 2008-September 2007 = -8, but should
>>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
>
> Use the undocumented DATEDIF function:
>
> =DATEDIF(B1,A1,"m")
>
> (The first date must be the earlier date).
>
>
> See http://www.cpearson.com/Excel/datedif.aspx for documentation.
>
> --ron


 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Terry Rogers 8/7/2008 9:04 AM PST
   
  How would you do this calculation for a range of cells all compared to the
current date but ignoring blank cells? ex: =(L25-M3) works fine (L25
contains the =today() formula to insert the current date) but where column
"N" contains no value it displays an errent number. In other words if there
is no value in column "M" I want no value returned.

"David Biddulph" wrote:

> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>
> An alternative to DATEDIF would be
> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
> Note that if you have different dates within the start and end months,
> you'll get different results from the 2 formulae.
> End of Jan to beginning of Feb gives a 1 month difference with the original
> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
> completed months (with various questions when months are of unequal length).
> --
> David Biddulph
>
> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike <Mike@discussions.microsoft.com>
> > wrote:
> >
> >>=MONTH(A1)-MONTH(B1)
> >>
> >>That works when the two months are in the same year, but what if they are
> >>in
> >>different years? For example January 2008-September 2007 = -8, but should
> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
> >
> > Use the undocumented DATEDIF function:
> >
> > =DATEDIF(B1,A1,"m")
> >
> > (The first date must be the earlier date).
> >
> >
> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
> >
> > --ron
>
>
>
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
VSlaybaugh 2/17/2009 1:20 PM PST
   
  I have tried this function but am having trouble with it returning the right
value. I have an end-date of 1/20/2010 (in cell F16) and a start-date of
2/11/2009 (in cell E16). I'm trying to calculate how many automatic monthly
transfers there will be on the 20th of each month but the function is
returning a value of 11 when it should return a value of 12. The first
transfer will be 2/20/2009 and the last transfer will be 1/20/2010…a total of
12 transfers.

"David Biddulph" wrote:

> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>
> An alternative to DATEDIF would be
> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
> Note that if you have different dates within the start and end months,
> you'll get different results from the 2 formulae.
> End of Jan to beginning of Feb gives a 1 month difference with the original
> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
> completed months (with various questions when months are of unequal length).
> --
> David Biddulph
>
> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike <Mike@discussions.microsoft.com>
> > wrote:
> >
> >>=MONTH(A1)-MONTH(B1)
> >>
> >>That works when the two months are in the same year, but what if they are
> >>in
> >>different years? For example January 2008-September 2007 = -8, but should
> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
> >
> > Use the undocumented DATEDIF function:
> >
> > =DATEDIF(B1,A1,"m")
> >
> > (The first date must be the earlier date).
> >
> >
> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
> >
> > --ron
>
>
>
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
T. Valko 2/17/2009 9:39 PM PST
   
  Try this:

E16 = start date
F16 = end date

=SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))

That will count how many 20th of the months there are from a start date to
an end date (inclusive).

--
Biff
Microsoft Excel MVP


"VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
>I have tried this function but am having trouble with it returning the
>right
> value. I have an end-date of 1/20/2010 (in cell F16) and a start-date of
> 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
> monthly
> transfers there will be on the 20th of each month but the function is
> returning a value of 11 when it should return a value of 12. The first
> transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a total
> of
> 12 transfers.
>
> "David Biddulph" wrote:
>
>> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>>
>> An alternative to DATEDIF would be
>> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
>> Note that if you have different dates within the start and end months,
>> you'll get different results from the 2 formulae.
>> End of Jan to beginning of Feb gives a 1 month difference with the
>> original
>> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
>> completed months (with various questions when months are of unequal
>> length).
>> --
>> David Biddulph
>>
>> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
>> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
>> > <Mike@discussions.microsoft.com>
>> > wrote:
>> >
>> >>=MONTH(A1)-MONTH(B1)
>> >>
>> >>That works when the two months are in the same year, but what if they
>> >>are
>> >>in
>> >>different years? For example January 2008-September 2007 = -8, but
>> >>should
>> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
>> >
>> > Use the undocumented DATEDIF function:
>> >
>> > =DATEDIF(B1,A1,"m")
>> >
>> > (The first date must be the earlier date).
>> >
>> >
>> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
>> >
>> > --ron
>>
>>
>>


 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Fred Smith 2/17/2009 9:54 PM PST
   
  Very impressive, Biff.

Fred

"T. Valko" <biffinpitt@comcast.net> wrote in message
news:O20Y2rYkJHA.3868@TK2MSFTNGP05.phx.gbl...
> Try this:
>
> E16 = start date
> F16 = end date
>
> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
>
> That will count how many 20th of the months there are from a start date to
> an end date (inclusive).
>
> --
> Biff
> Microsoft Excel MVP
>
>
> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
>>I have tried this function but am having trouble with it returning the
>>right
>> value. I have an end-date of 1/20/2010 (in cell F16) and a start-date of
>> 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
>> monthly
>> transfers there will be on the 20th of each month but the function is
>> returning a value of 11 when it should return a value of 12. The first
>> transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a
>> total of
>> 12 transfers.
>>
>> "David Biddulph" wrote:
>>
>>> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>>>
>>> An alternative to DATEDIF would be
>>> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
>>> Note that if you have different dates within the start and end months,
>>> you'll get different results from the 2 formulae.
>>> End of Jan to beginning of Feb gives a 1 month difference with the
>>> original
>>> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
>>> completed months (with various questions when months are of unequal
>>> length).
>>> --
>>> David Biddulph
>>>
>>> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>>> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
>>> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
>>> > <Mike@discussions.microsoft.com>
>>> > wrote:
>>> >
>>> >>=MONTH(A1)-MONTH(B1)
>>> >>
>>> >>That works when the two months are in the same year, but what if they
>>> >>are
>>> >>in
>>> >>different years? For example January 2008-September 2007 = -8, but
>>> >>should
>>> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
>>> >
>>> > Use the undocumented DATEDIF function:
>>> >
>>> > =DATEDIF(B1,A1,"m")
>>> >
>>> > (The first date must be the earlier date).
>>> >
>>> >
>>> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
>>> >
>>> > --ron
>>>
>>>
>>>
>
>

 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
T. Valko 2/17/2009 10:12 PM PST
   
  Thanks!

--
Biff
Microsoft Excel MVP


"Fred Smith" <fsmith11@yahooo.com> wrote in message
news:Oizs70YkJHA.1340@TK2MSFTNGP06.phx.gbl...
> Very impressive, Biff.
>
> Fred
>
> "T. Valko" <biffinpitt@comcast.net> wrote in message
> news:O20Y2rYkJHA.3868@TK2MSFTNGP05.phx.gbl...
>> Try this:
>>
>> E16 = start date
>> F16 = end date
>>
>> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
>>
>> That will count how many 20th of the months there are from a start date
>> to an end date (inclusive).
>>
>> --
>> Biff
>> Microsoft Excel MVP
>>
>>
>> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
>> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
>>>I have tried this function but am having trouble with it returning the
>>>right
>>> value. I have an end-date of 1/20/2010 (in cell F16) and a start-date of
>>> 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
>>> monthly
>>> transfers there will be on the 20th of each month but the function is
>>> returning a value of 11 when it should return a value of 12. The first
>>> transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a
>>> total of
>>> 12 transfers.
>>>
>>> "David Biddulph" wrote:
>>>
>>>> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>>>>
>>>> An alternative to DATEDIF would be
>>>> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
>>>> Note that if you have different dates within the start and end months,
>>>> you'll get different results from the 2 formulae.
>>>> End of Jan to beginning of Feb gives a 1 month difference with the
>>>> original
>>>> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
>>>> completed months (with various questions when months are of unequal
>>>> length).
>>>> --
>>>> David Biddulph
>>>>
>>>> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>>>> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
>>>> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
>>>> > <Mike@discussions.microsoft.com>
>>>> > wrote:
>>>> >
>>>> >>=MONTH(A1)-MONTH(B1)
>>>> >>
>>>> >>That works when the two months are in the same year, but what if they
>>>> >>are
>>>> >>in
>>>> >>different years? For example January 2008-September 2007 = -8, but
>>>> >>should
>>>> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
>>>> >
>>>> > Use the undocumented DATEDIF function:
>>>> >
>>>> > =DATEDIF(B1,A1,"m")
>>>> >
>>>> > (The first date must be the earlier date).
>>>> >
>>>> >
>>>> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
>>>> >
>>>> > --ron
>>>>
>>>>
>>>>
>>
>>
>


 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
VSlaybaugh 2/18/2009 7:27 AM PST
   
  Wow! This works great. I appreciate your quick responses when I submit a
problem I'm having. You always have a solution that works. I just wish I
understood what you did to make it happen. :-)

"T. Valko" wrote:

> Try this:
>
> E16 = start date
> F16 = end date
>
> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
>
> That will count how many 20th of the months there are from a start date to
> an end date (inclusive).
>
> --
> Biff
> Microsoft Excel MVP
>
>
> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
> >I have tried this function but am having trouble with it returning the
> >right
> > value. I have an end-date of 1/20/2010 (in cell F16) and a start-date of
> > 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
> > monthly
> > transfers there will be on the 20th of each month but the function is
> > returning a value of 11 when it should return a value of 12. The first
> > transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a total
> > of
> > 12 transfers.
> >
> > "David Biddulph" wrote:
> >
> >> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
> >>
> >> An alternative to DATEDIF would be
> >> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
> >> Note that if you have different dates within the start and end months,
> >> you'll get different results from the 2 formulae.
> >> End of Jan to beginning of Feb gives a 1 month difference with the
> >> original
> >> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
> >> completed months (with various questions when months are of unequal
> >> length).
> >> --
> >> David Biddulph
> >>
> >> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> >> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
> >> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
> >> > <Mike@discussions.microsoft.com>
> >> > wrote:
> >> >
> >> >>=MONTH(A1)-MONTH(B1)
> >> >>
> >> >>That works when the two months are in the same year, but what if they
> >> >>are
> >> >>in
> >> >>different years? For example January 2008-September 2007 = -8, but
> >> >>should
> >> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
> >> >
> >> > Use the undocumented DATEDIF function:
> >> >
> >> > =DATEDIF(B1,A1,"m")
> >> >
> >> > (The first date must be the earlier date).
> >> >
> >> >
> >> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
> >> >
> >> > --ron
> >>
> >>
> >>
>
>
>
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
T. Valko 2/18/2009 9:08 AM PST
   
  You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
news:A9E99FBF-394D-4034-AE52-C74D9E8B7FF5@microsoft.com...
> Wow! This works great. I appreciate your quick responses when I submit a
> problem I'm having. You always have a solution that works. I just wish I
> understood what you did to make it happen. :-)
>
> "T. Valko" wrote:
>
>> Try this:
>>
>> E16 = start date
>> F16 = end date
>>
>> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
>>
>> That will count how many 20th of the months there are from a start date
>> to
>> an end date (inclusive).
>>
>> --
>> Biff
>> Microsoft Excel MVP
>>
>>
>> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
>> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
>> >I have tried this function but am having trouble with it returning the
>> >right
>> > value. I have an end-date of 1/20/2010 (in cell F16) and a start-date
>> > of
>> > 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
>> > monthly
>> > transfers there will be on the 20th of each month but the function is
>> > returning a value of 11 when it should return a value of 12. The first
>> > transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a
>> > total
>> > of
>> > 12 transfers.
>> >
>> > "David Biddulph" wrote:
>> >
>> >> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>> >>
>> >> An alternative to DATEDIF would be
>> >> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
>> >> Note that if you have different dates within the start and end months,
>> >> you'll get different results from the 2 formulae.
>> >> End of Jan to beginning of Feb gives a 1 month difference with the
>> >> original
>> >> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
>> >> completed months (with various questions when months are of unequal
>> >> length).
>> >> --
>> >> David Biddulph
>> >>
>> >> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>> >> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
>> >> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
>> >> > <Mike@discussions.microsoft.com>
>> >> > wrote:
>> >> >
>> >> >>=MONTH(A1)-MONTH(B1)
>> >> >>
>> >> >>That works when the two months are in the same year, but what if
>> >> >>they
>> >> >>are
>> >> >>in
>> >> >>different years? For example January 2008-September 2007 = -8, but
>> >> >>should
>> >> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
>> >> >
>> >> > Use the undocumented DATEDIF function:
>> >> >
>> >> > =DATEDIF(B1,A1,"m")
>> >> >
>> >> > (The first date must be the earlier date).
>> >> >
>> >> >
>> >> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
>> >> >
>> >> > --ron
>> >>
>> >>
>> >>
>>
>>
>>


 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Imran ul Haque 4/15/2009 4:30 AM PST
   
  Can you help me in finding difference of data between 12/10/2003 &
2/14/2009. With datedif or usual cell1 - cell2 formulae it shows 1893 days
where as my manual calculation shows it to be
Year Days
2003 52
2004 360
2005 360
2006 360
2007 360
2008 360
2009 45
Total 1897

Appreciate you help.
Imran


"T. Valko" wrote:

> You're welcome. Thanks for the feedback!
>
> --
> Biff
> Microsoft Excel MVP
>
>
> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
> news:A9E99FBF-394D-4034-AE52-C74D9E8B7FF5@microsoft.com...
> > Wow! This works great. I appreciate your quick responses when I submit a
> > problem I'm having. You always have a solution that works. I just wish I
> > understood what you did to make it happen. :-)
> >
> > "T. Valko" wrote:
> >
> >> Try this:
> >>
> >> E16 = start date
> >> F16 = end date
> >>
> >> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
> >>
> >> That will count how many 20th of the months there are from a start date
> >> to
> >> an end date (inclusive).
> >>
> >> --
> >> Biff
> >> Microsoft Excel MVP
> >>
> >>
> >> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
> >> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
> >> >I have tried this function but am having trouble with it returning the
> >> >right
> >> > value. I have an end-date of 1/20/2010 (in cell F16) and a start-date
> >> > of
> >> > 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
> >> > monthly
> >> > transfers there will be on the 20th of each month but the function is
> >> > returning a value of 11 when it should return a value of 12. The first
> >> > transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a
> >> > total
> >> > of
> >> > 12 transfers.
> >> >
> >> > "David Biddulph" wrote:
> >> >
> >> >> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
> >> >>
> >> >> An alternative to DATEDIF would be
> >> >> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
> >> >> Note that if you have different dates within the start and end months,
> >> >> you'll get different results from the 2 formulae.
> >> >> End of Jan to beginning of Feb gives a 1 month difference with the
> >> >> original
> >> >> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
> >> >> completed months (with various questions when months are of unequal
> >> >> length).
> >> >> --
> >> >> David Biddulph
> >> >>
> >> >> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> >> >> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
> >> >> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
> >> >> > <Mike@discussions.microsoft.com>
> >> >> > wrote:
> >> >> >
> >> >> >>=MONTH(A1)-MONTH(B1)
> >> >> >>
> >> >> >>That works when the two months are in the same year, but what if
> >> >> >>they
> >> >> >>are
> >> >> >>in
> >> >> >>different years? For example January 2008-September 2007 = -8, but
> >> >> >>should
> >> >> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
> >> >> >
> >> >> > Use the undocumented DATEDIF function:
> >> >> >
> >> >> > =DATEDIF(B1,A1,"m")
> >> >> >
> >> >> > (The first date must be the earlier date).
> >> >> >
> >> >> >
> >> >> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
> >> >> >
> >> >> > --ron
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Imran ul Haque 4/15/2009 4:34 AM PST
   
  sorry but the actual manual calculation is as follows:

Year Days
2003 52
2004 364
2005 364
2006 365
2007 364
2008 364
2009 45
Total days 1918


"Imran ul Haque" wrote:

> Can you help me in finding difference of data between 12/10/2003 &
> 2/14/2009. With datedif or usual cell1 - cell2 formulae it shows 1893 days
> where as my manual calculation shows it to be
> Year Days
> 2003 52
> 2004 360
> 2005 360
> 2006 360
> 2007 360
> 2008 360
> 2009 45
> Total 1897
>
> Appreciate you help.
> Imran
>
>
> "T. Valko" wrote:
>
> > You're welcome. Thanks for the feedback!
> >
> > --
> > Biff
> > Microsoft Excel MVP
> >
> >
> > "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
> > news:A9E99FBF-394D-4034-AE52-C74D9E8B7FF5@microsoft.com...
> > > Wow! This works great. I appreciate your quick responses when I submit a
> > > problem I'm having. You always have a solution that works. I just wish I
> > > understood what you did to make it happen. :-)
> > >
> > > "T. Valko" wrote:
> > >
> > >> Try this:
> > >>
> > >> E16 = start date
> > >> F16 = end date
> > >>
> > >> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
> > >>
> > >> That will count how many 20th of the months there are from a start date
> > >> to
> > >> an end date (inclusive).
> > >>
> > >> --
> > >> Biff
> > >> Microsoft Excel MVP
> > >>
> > >>
> > >> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
> > >> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
> > >> >I have tried this function but am having trouble with it returning the
> > >> >right
> > >> > value. I have an end-date of 1/20/2010 (in cell F16) and a start-date
> > >> > of
> > >> > 2/11/2009 (in cell E16). I'm trying to calculate how many automatic
> > >> > monthly
> > >> > transfers there will be on the 20th of each month but the function is
> > >> > returning a value of 11 when it should return a value of 12. The first
> > >> > transfer will be 2/20/2009 and the last transfer will be 1/20/2010.a
> > >> > total
> > >> > of
> > >> > 12 transfers.
> > >> >
> > >> > "David Biddulph" wrote:
> > >> >
> > >> >> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
> > >> >>
> > >> >> An alternative to DATEDIF would be
> > >> >> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
> > >> >> Note that if you have different dates within the start and end months,
> > >> >> you'll get different results from the 2 formulae.
> > >> >> End of Jan to beginning of Feb gives a 1 month difference with the
> > >> >> original
> > >> >> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF counts
> > >> >> completed months (with various questions when months are of unequal
> > >> >> length).
> > >> >> --
> > >> >> David Biddulph
> > >> >>
> > >> >> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> > >> >> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
> > >> >> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
> > >> >> > <Mike@discussions.microsoft.com>
> > >> >> > wrote:
> > >> >> >
> > >> >> >>=MONTH(A1)-MONTH(B1)
> > >> >> >>
> > >> >> >>That works when the two months are in the same year, but what if
> > >> >> >>they
> > >> >> >>are
> > >> >> >>in
> > >> >> >>different years? For example January 2008-September 2007 = -8, but
> > >> >> >>should
> > >> >> >>equal 4. Or December 2008-January 2006 = 11, but should equal 23.
> > >> >> >
> > >> >> > Use the undocumented DATEDIF function:
> > >> >> >
> > >> >> > =DATEDIF(B1,A1,"m")
> > >> >> >
> > >> >> > (The first date must be the earlier date).
> > >> >> >
> > >> >> >
> > >> >> > See http://www.cpearson.com/Excel/datedif.aspx for documentation.
> > >> >> >
> > >> >> > --ron
> > >> >>
> > >> >>
> > >> >>
> > >>
> > >>
> > >>
> >
> >
> >
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Fred Smith 4/15/2009 5:05 AM PST
   
  Imran,

First, if you have a new query, start a new thread. When you add to an
existing thread, there's too much chance it will get lost.
Second, there are 365 days in a year, not 364. In leap years, there are 366.
Third, you need to be consistent in your date formats. Because the second
date can only be Feb 14/09, the first date must be Dec 10/03, not Oct 12.

So, your actual days in between are:
2003: 21
2004: 366
2005: 365
2006: 365
2007: 365
2008: 366
2009: 45
Total: 1893

Regards,
Fred.

"Imran ul Haque" <ImranulHaque@discussions.microsoft.com> wrote in message
news:F1AF62F9-9AA1-4214-BA82-8D2038B2C43D@microsoft.com...
> sorry but the actual manual calculation is as follows:
>
> Year Days
> 2003 52
> 2004 364
> 2005 364
> 2006 365
> 2007 364
> 2008 364
> 2009 45
> Total days 1918
>
>
> "Imran ul Haque" wrote:
>
>> Can you help me in finding difference of data between 12/10/2003 &
>> 2/14/2009. With datedif or usual cell1 - cell2 formulae it shows 1893
>> days
>> where as my manual calculation shows it to be
>> Year Days
>> 2003 52
>> 2004 360
>> 2005 360
>> 2006 360
>> 2007 360
>> 2008 360
>> 2009 45
>> Total 1897
>>
>> Appreciate you help.
>> Imran
>>
>>
>> "T. Valko" wrote:
>>
>> > You're welcome. Thanks for the feedback!
>> >
>> > --
>> > Biff
>> > Microsoft Excel MVP
>> >
>> >
>> > "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
>> > news:A9E99FBF-394D-4034-AE52-C74D9E8B7FF5@microsoft.com...
>> > > Wow! This works great. I appreciate your quick responses when I
>> > > submit a
>> > > problem I'm having. You always have a solution that works. I just
>> > > wish I
>> > > understood what you did to make it happen. :-)
>> > >
>> > > "T. Valko" wrote:
>> > >
>> > >> Try this:
>> > >>
>> > >> E16 = start date
>> > >> F16 = end date
>> > >>
>> > >> =SUMPRODUCT(--(DAY(ROW(INDIRECT(E16&":"&F16)))=20))
>> > >>
>> > >> That will count how many 20th of the months there are from a start
>> > >> date
>> > >> to
>> > >> an end date (inclusive).
>> > >>
>> > >> --
>> > >> Biff
>> > >> Microsoft Excel MVP
>> > >>
>> > >>
>> > >> "VSlaybaugh" <VSlaybaugh@discussions.microsoft.com> wrote in message
>> > >> news:5332096C-FA5F-4898-81F7-10566A2083DA@microsoft.com...
>> > >> >I have tried this function but am having trouble with it returning
>> > >> >the
>> > >> >right
>> > >> > value. I have an end-date of 1/20/2010 (in cell F16) and a
>> > >> > start-date
>> > >> > of
>> > >> > 2/11/2009 (in cell E16). I'm trying to calculate how many
>> > >> > automatic
>> > >> > monthly
>> > >> > transfers there will be on the 20th of each month but the function
>> > >> > is
>> > >> > returning a value of 11 when it should return a value of 12. The
>> > >> > first
>> > >> > transfer will be 2/20/2009 and the last transfer will be
>> > >> > 1/20/2010.a
>> > >> > total
>> > >> > of
>> > >> > 12 transfers.
>> > >> >
>> > >> > "David Biddulph" wrote:
>> > >> >
>> > >> >> I hope that Dec 2008 - Jan 2006 is 35, rather than 23. :-)
>> > >> >>
>> > >> >> An alternative to DATEDIF would be
>> > >> >> =MONTH(A1)-MONTH(B1)+12*(YEAR(A1)-YEAR(B1))
>> > >> >> Note that if you have different dates within the start and end
>> > >> >> months,
>> > >> >> you'll get different results from the 2 formulae.
>> > >> >> End of Jan to beginning of Feb gives a 1 month difference with
>> > >> >> the
>> > >> >> original
>> > >> >> =MONTH(A1)-MONTH(B1) and with my extension thereto, but DATEDIF
>> > >> >> counts
>> > >> >> completed months (with various questions when months are of
>> > >> >> unequal
>> > >> >> length).
>> > >> >> --
>> > >> >> David Biddulph
>> > >> >>
>> > >> >> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>> > >> >> news:l7mgn3ppv2amhduuqdd76njmlr059fedis@4ax.com...
>> > >> >> > On Sun, 30 Dec 2007 18:37:01 -0800, Mike
>> > >> >> > <Mike@discussions.microsoft.com>
>> > >> >> > wrote:
>> > >> >> >
>> > >> >> >>=MONTH(A1)-MONTH(B1)
>> > >> >> >>
>> > >> >> >>That works when the two months are in the same year, but what
>> > >> >> >>if
>> > >> >> >>they
>> > >> >> >>are
>> > >> >> >>in
>> > >> >> >>different years? For example January 2008-September 2007 = -8,
>> > >> >> >>but
>> > >> >> >>should
>> > >> >> >>equal 4. Or December 2008-January 2006 = 11, but should equal
>> > >> >> >>23.
>> > >> >> >
>> > >> >> > Use the undocumented DATEDIF function:
>> > >> >> >
>> > >> >> > =DATEDIF(B1,A1,"m")
>> > >> >> >
>> > >> >> > (The first date must be the earlier date).
>> > >> >> >
>> > >> >> >
>> > >> >> > See http://www.cpearson.com/Excel/datedif.aspx for
>> > >> >> > documentation.
>> > >> >> >
>> > >> >> > --ron
>> > >> >>
>> > >> >>
>> > >> >>
>> > >>
>> > >>
>> > >>
>> >
>> >
>> >

 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
  Return to Microsoft Communities  Notify me of replies  
  More...