ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DateDifference Question (https://www.excelbanter.com/excel-programming/295319-datedifference-question.html)

Junior[_2_]

DateDifference Question
 
I want to compare two cells containing dates (beginning and ending) and
return the number of months difference -
the purpose is to use this figure for computing annual turnover.
I can't seem to get DateDiff calculation that works in Access to work in
Excel
Help please

DateDiff("m",start, end)



Chip Pearson

DateDifference Question
 
Your code should work in VBA the same way. E.g.,

Debug.Print DateDiff("m", #1/1/2004#, Now)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Junior" wrote in message
...
I want to compare two cells containing dates (beginning and

ending) and
return the number of months difference -
the purpose is to use this figure for computing annual

turnover.
I can't seem to get DateDiff calculation that works in Access

to work in
Excel
Help please

DateDiff("m",start, end)





Junior[_2_]

DateDifference Question
 
Thanks chip - figured it out - function is a little different and reversed
in excel....

DateDif (start date, end date, "m")

"Chip Pearson" wrote in message
...
Your code should work in VBA the same way. E.g.,

Debug.Print DateDiff("m", #1/1/2004#, Now)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Junior" wrote in message
...
I want to compare two cells containing dates (beginning and

ending) and
return the number of months difference -
the purpose is to use this figure for computing annual

turnover.
I can't seem to get DateDiff calculation that works in Access

to work in
Excel
Help please

DateDiff("m",start, end)







Chris

DateDifference Question
 
use DateAdd function to accomplish your task (it does subtractions too)


All times are GMT +1. The time now is 08:27 AM.

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