PC Review


Reply
Thread Tools Rate Thread

How to calculate "number of months" between two given date?

 
 
=?Utf-8?B?bmdpbmhvbmc=?=
Guest
Posts: n/a
 
      12th Apr 2006
Example 1
Start date: 12/04/2004
End date: 12/04/2006
The formula should give the answer to 24 months

Example 2
Start date: 12/04/2004
End date: 13/04/2006
The formula should give the answer to 25 months

When I use function =(YEAR(A4)-YEAR(A3))*12+MONTH(A4)-MONTH(A3), it does not
show 25 months for "Example 2" as it is still within the same month "April"

Your kind support is greatly appreciated.

TQ!//nginhong
 
Reply With Quote
 
 
 
 
Arvi Laanemets
Guest
Posts: n/a
 
      12th Apr 2006
Hi


=DATEDIF(StartDate,EndDate,"M")


--
Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )


"nginhong" <(E-Mail Removed)> wrote in message
news3EEC526-8567-4ACD-BBD8-(E-Mail Removed)...
> Example 1
> Start date: 12/04/2004
> End date: 12/04/2006
> The formula should give the answer to 24 months
>
> Example 2
> Start date: 12/04/2004
> End date: 13/04/2006
> The formula should give the answer to 25 months
>
> When I use function =(YEAR(A4)-YEAR(A3))*12+MONTH(A4)-MONTH(A3), it does
> not
> show 25 months for "Example 2" as it is still within the same month
> "April"
>
> Your kind support is greatly appreciated.
>
> TQ!//nginhong



 
Reply With Quote
 
John James
Guest
Posts: n/a
 
      12th Apr 2006

How about
=(YEAR(A3)-YEAR(A2))*12+MONTH(A3)-MONTH(A2
+ROUNDUP((DAY(A3)-DAY(A2))/31,0

Closer

--
John Jame
-----------------------------------------------------------------------
John James's Profile: http://www.excelforum.com/member.php...fo&userid=3269
View this thread: http://www.excelforum.com/showthread.php?threadid=53216

 
Reply With Quote
 
=?Utf-8?B?bmdpbmhvbmc=?=
Guest
Posts: n/a
 
      12th Apr 2006
Hello John,

It seems like the formula you provided contains error.

BR//nginhong

"John James" wrote:

>
> How about:
> =(YEAR(A3)-YEAR(A2))*12+MONTH(A3)-MONTH(A2)
> +ROUNDUP((DAY(A3)-DAY(A2))/31,0)
>
> Closer?
>
>
> --
> John James
> ------------------------------------------------------------------------
> John James's Profile: http://www.excelforum.com/member.php...o&userid=32690
> View this thread: http://www.excelforum.com/showthread...hreadid=532164
>
>

 
Reply With Quote
 
=?Utf-8?B?bmdpbmhvbmc=?=
Guest
Posts: n/a
 
      12th Apr 2006
Hello Arvi,

It seems like the formula you provided contains error.

BR//nginhong

"Arvi Laanemets" wrote:

> Hi
>
>
> =DATEDIF(StartDate,EndDate,"M")
>
>
> --
> Arvi Laanemets
> ( My real mail address: arvi.laanemets<at>tarkon.ee )
>
>
> "nginhong" <(E-Mail Removed)> wrote in message
> news3EEC526-8567-4ACD-BBD8-(E-Mail Removed)...
> > Example 1
> > Start date: 12/04/2004
> > End date: 12/04/2006
> > The formula should give the answer to 24 months
> >
> > Example 2
> > Start date: 12/04/2004
> > End date: 13/04/2006
> > The formula should give the answer to 25 months
> >
> > When I use function =(YEAR(A4)-YEAR(A3))*12+MONTH(A4)-MONTH(A3), it does
> > not
> > show 25 months for "Example 2" as it is still within the same month
> > "April"
> >
> > Your kind support is greatly appreciated.
> >
> > TQ!//nginhong

>
>
>

 
Reply With Quote
 
Arvi Laanemets
Guest
Posts: n/a
 
      12th Apr 2006
Hi

What kind of error?

I'm afraid you dates aren't really dates at all, but strings. Change the
format for some date to general - when the value in cell turns to number,
then the entry was a date, otherwise it was not.



--
Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )



"nginhong" <(E-Mail Removed)> wrote in message
news:18E780F3-73E6-4F34-97E1-(E-Mail Removed)...
> Hello Arvi,
>
> It seems like the formula you provided contains error.
>
> BR//nginhong
>
> "Arvi Laanemets" wrote:
>
>> Hi
>>
>>
>> =DATEDIF(StartDate,EndDate,"M")
>>
>>
>> --
>> Arvi Laanemets
>> ( My real mail address: arvi.laanemets<at>tarkon.ee )
>>
>>
>> "nginhong" <(E-Mail Removed)> wrote in message
>> news3EEC526-8567-4ACD-BBD8-(E-Mail Removed)...
>> > Example 1
>> > Start date: 12/04/2004
>> > End date: 12/04/2006
>> > The formula should give the answer to 24 months
>> >
>> > Example 2
>> > Start date: 12/04/2004
>> > End date: 13/04/2006
>> > The formula should give the answer to 25 months
>> >
>> > When I use function =(YEAR(A4)-YEAR(A3))*12+MONTH(A4)-MONTH(A3), it
>> > does
>> > not
>> > show 25 months for "Example 2" as it is still within the same month
>> > "April"
>> >
>> > Your kind support is greatly appreciated.
>> >
>> > TQ!//nginhong

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?bmdpbmhvbmc=?=
Guest
Posts: n/a
 
      12th Apr 2006
Hello Arvi,

Thanks for you reply.

Let me know frame the idea of how the excel sheet looks like.

I put start date in cell A2 = 12/04/2004 & end date A3 = 13/04/2006
Then use your formula as in cell A4 =DATEDIF((A2),(A3),"M") and press enter,
however error message shows:-

The formula you typed contains error.
- For information about fixing common formula problems, click Help.
- To get assistance in entering a function, click OK, then click Function on
the Insert menu.
- If you are not trying to enter a formula, avoid using an equal sign (=) or
minus sign (-), or precede it with a single quotation mark (')

BR//nginhong

"Arvi Laanemets" wrote:

> Hi
>
> What kind of error?
>
> I'm afraid you dates aren't really dates at all, but strings. Change the
> format for some date to general - when the value in cell turns to number,
> then the entry was a date, otherwise it was not.
>
>
>
> --
> Arvi Laanemets
> ( My real mail address: arvi.laanemets<at>tarkon.ee )
>
>
>
> "nginhong" <(E-Mail Removed)> wrote in message
> news:18E780F3-73E6-4F34-97E1-(E-Mail Removed)...
> > Hello Arvi,
> >
> > It seems like the formula you provided contains error.
> >
> > BR//nginhong
> >
> > "Arvi Laanemets" wrote:
> >
> >> Hi
> >>
> >>
> >> =DATEDIF(StartDate,EndDate,"M")
> >>
> >>
> >> --
> >> Arvi Laanemets
> >> ( My real mail address: arvi.laanemets<at>tarkon.ee )
> >>
> >>
> >> "nginhong" <(E-Mail Removed)> wrote in message
> >> news3EEC526-8567-4ACD-BBD8-(E-Mail Removed)...
> >> > Example 1
> >> > Start date: 12/04/2004
> >> > End date: 12/04/2006
> >> > The formula should give the answer to 24 months
> >> >
> >> > Example 2
> >> > Start date: 12/04/2004
> >> > End date: 13/04/2006
> >> > The formula should give the answer to 25 months
> >> >
> >> > When I use function =(YEAR(A4)-YEAR(A3))*12+MONTH(A4)-MONTH(A3), it
> >> > does
> >> > not
> >> > show 25 months for "Example 2" as it is still within the same month
> >> > "April"
> >> >
> >> > Your kind support is greatly appreciated.
> >> >
> >> > TQ!//nginhong
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Arvi Laanemets
Guest
Posts: n/a
 
      12th Apr 2006
Hi


"nginhong" <(E-Mail Removed)> wrote in message
newsE8347CE-181F-4FCE-A7A3-(E-Mail Removed)...
> Hello Arvi,
>
> Thanks for you reply.
>
> Let me know frame the idea of how the excel sheet looks like.
>
> I put start date in cell A2 = 12/04/2004 & end date A3 = 13/04/2006



Select cells A2:A3, and set cell format to General. When those are really
dates, then now you see values 38089 and 38819


> Then use your formula as in cell A4 =DATEDIF((A2),(A3),"M") and press
> enter,



You can simplify the formula a bit
=DATEDIF(A2,A3,"M")



> however error message shows:-
>
> The formula you typed contains error.
> - For information about fixing common formula problems, click Help.
> - To get assistance in entering a function, click OK, then click Function
> on
> the Insert menu.
> - If you are not trying to enter a formula, avoid using an equal sign (=)
> or
> minus sign (-), or precede it with a single quotation mark (')



What is function parameter delimiter for your regional settings? Comma or
semicolon? Try:
=DATEDIF(A2;A3;"M")


--
Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )


 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      12th Apr 2006
On Wed, 12 Apr 2006 03:21:01 -0700, nginhong
<(E-Mail Removed)> wrote:

>=DATEDIF((A2),(A3),"M")


Perhaps your country version of excel uses semicolons for delimiters?

=DATEDIF((A2);(A3);"M")

Also, the parentheses around the cell references are unnecessary:

=DATEDIF(A2;A3;"M")


--ron
 
Reply With Quote
 
=?Utf-8?B?bmdpbmhvbmc=?=
Guest
Posts: n/a
 
      12th Apr 2006
dHello Ron,

You are right! The country setting is using semicolons for delimiters and
managed to use the formula but the result is not what I wanted.

Thanks & Regards,
nginhong

"Ron Rosenfeld" wrote:

> On Wed, 12 Apr 2006 03:21:01 -0700, nginhong
> <(E-Mail Removed)> wrote:
>
> >=DATEDIF((A2),(A3),"M")

>
> Perhaps your country version of excel uses semicolons for delimiters?
>
> =DATEDIF((A2);(A3);"M")
>
> Also, the parentheses around the cell references are unnecessary:
>
> =DATEDIF(A2;A3;"M")
>
>
> --ron
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
calculate number of months based on one date JK Microsoft Excel Misc 1 5th Mar 2009 05:51 PM
calculate number of months from baseline date airnuminz@yahoo.com Microsoft Access Queries 2 26th Jun 2007 07:16 PM
Can I calculate "date + number of days" in a Word template? =?Utf-8?B?TWVXaXZGcmVl?= Microsoft Word Document Management 3 1st Apr 2006 10:41 AM
calculate number of months from date entry =?Utf-8?B?Q293dG9vbg==?= Microsoft Excel Misc 2 10th Nov 2004 05:09 PM
How to calculate 12 months from "Date Added" field Sandi Gauthier Microsoft Excel Worksheet Functions 2 19th Nov 2003 05:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:38 PM.