View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
nginhong
 
Posts: n/a
Default How to calculate "number of months" between two given date?

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<attarkon.ee )



"nginhong" wrote in message
...
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<attarkon.ee )


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