ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Result in days and/or months (https://www.excelbanter.com/excel-discussion-misc-queries/165959-result-days-months.html)

Scott

Result in days and/or months
 
I would like to calculate two dates and get the result in days and/or
months. Can someone advise the syntax to get it.

Thanks,

Scott


carlo

Result in days and/or months
 
On Nov 14, 3:02 pm, "Scott" wrote:
I would like to calculate two dates and get the result in days and/or
months. Can someone advise the syntax to get it.

Thanks,

Scott


Hi Scott

Let's say A1 is your first date '1.Nov 2007
A2 is your second date '14.Nov 2007

you want to have the number of days in B1:
=A2-A1
Format the cell as general, it returns 13

you want to have the number of months in B2:
=month(A2-A1) + (year(A2-A1)-1900)*12

you want to have the numbers of days, without months
=day(A2-A1)

hth

Carlo


David Biddulph[_2_]

Result in days and/or months
 
For number of months you may find =DATEDIF(A1,A2,"m") easier than Carlo's
formula.
--
David Biddulph

"carlo" wrote in message
ups.com...
On Nov 14, 3:02 pm, "Scott" wrote:
I would like to calculate two dates and get the result in days and/or
months. Can someone advise the syntax to get it.

Thanks,

Scott


Hi Scott

Let's say A1 is your first date '1.Nov 2007
A2 is your second date '14.Nov 2007

you want to have the number of days in B1:
=A2-A1
Format the cell as general, it returns 13

you want to have the number of months in B2:
=month(A2-A1) + (year(A2-A1)-1900)*12

you want to have the numbers of days, without months
=day(A2-A1)

hth

Carlo




carlo

Result in days and/or months
 
On Nov 14, 3:02 pm, "Scott" wrote:
I would like to calculate two dates and get the result in days and/or
months. Can someone advise the syntax to get it.

Thanks,

Scott


Let's say A1 is your first date '1.Nov 2007
A2 is your second date '14.Nov 2007

you want to have the number of days in B1:
=A2-A1
Format the cell as general, it returns 13

you want to have the number of months in B2:
=month(A2-A1) + (year(A2-A1)-1900)*12

you want to have the numbers of days, without months
=day(A2-A1)

hth

Carlo



All times are GMT +1. The time now is 10:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com