Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tc tc is offline
external usenet poster
 
Posts: 40
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between two dates dlw Excel Discussion (Misc queries) 1 March 3rd 10 08:15 PM
Difference between two dates Sheeloo Excel Discussion (Misc queries) 0 March 3rd 10 05:25 PM
Difference between dates Khurum Excel Worksheet Functions 12 August 13th 08 12:53 AM
Difference of two dates Zafar Excel Worksheet Functions 3 July 26th 07 08:44 AM
Difference of two dates sajan chauhan Excel Discussion (Misc queries) 3 June 5th 07 04:47 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"