ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Difference between two dates (https://www.excelbanter.com/excel-programming/403766-difference-between-two-dates.html)

tc

Difference between two dates
 
hi. i need to create a macro that will alow me to find the difference
in days between two given dates. is this possible?
thanks

Gary''s Student

Difference between two dates
 
if the dates are in A1 and B1, then

=MAX(A1,B1)-MIN(A1,B1)
--
Gary''s Student - gsnu200764


"tc" wrote:

hi. i need to create a macro that will alow me to find the difference
in days between two given dates. is this possible?
thanks


Dave Peterson

Difference between two dates
 
Just subtract them

Dim Date1 as date
dim Date2 as date

date1 = dateserial(2007,12,25)
date2 = dateserial(2008,1,13)

msgbox date2 - date1 '+ 1

Is the 3rd - 1st a difference of 3 days or 2 days?

tc wrote:

hi. i need to create a macro that will alow me to find the difference
in days between two given dates. is this possible?
thanks


--

Dave Peterson

Rick Rothstein \(MVP - VB\)

Difference between two dates
 
Why not just this...

=ABS(B1-A1)

instead?

Rick


"Gary''s Student" wrote in message
...
if the dates are in A1 and B1, then

=MAX(A1,B1)-MIN(A1,B1)
--
Gary''s Student - gsnu200764


"tc" wrote:

hi. i need to create a macro that will alow me to find the difference
in days between two given dates. is this possible?
thanks




All times are GMT +1. The time now is 07:28 PM.

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