Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default DAY BETWEEN TWO DATES AND TIME

I would like to know how many days between two dates and time.
Exemple: 1 Dec 14:00 to 3 Dec 21:00, will be 2 days but I want to know
how many days it will when you go over 6 hours more than the 24 hours.
The exemple shown it will be 3 days.
You can reply via my email:

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default DAY BETWEEN TWO DATES AND TIME

Try this out - edit the ranges to match your date locations - never tried
this before, but i think this will get the answer u need.

Dim tst As Variant
Dim tst1 As Variant
Dim tst3 As Variant

tst1 = DateDiff("d", Range("G12"), Range("H12"))
tst = DateDiff("h", Range("G12"), Range("H12")) / 24
tst = Left(tst, 4)
tst = Right(tst, 3)
If tst = 0.29 Then
tst3 = tst1 + 1
Else
tst3 = tst1
End If
MsgBox tst3

Devin

" wrote:

I would like to know how many days between two dates and time.
Exemple: 1 Dec 14:00 to 3 Dec 21:00, will be 2 days but I want to know
how many days it will when you go over 6 hours more than the 24 hours.
The exemple shown it will be 3 days.
You can reply via my email:


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default DAY BETWEEN TWO DATES AND TIME

Here is a formula solution

=INT(B1-A1)+1+(MOD((B1-A1),1)0.25)*1

--
HTH

-------

Bob Phillips
"DMoney" wrote in message
...
Try this out - edit the ranges to match your date locations - never

tried
this before, but i think this will get the answer u need.

Dim tst As Variant
Dim tst1 As Variant
Dim tst3 As Variant

tst1 = DateDiff("d", Range("G12"), Range("H12"))
tst = DateDiff("h", Range("G12"), Range("H12")) / 24
tst = Left(tst, 4)
tst = Right(tst, 3)
If tst = 0.29 Then
tst3 = tst1 + 1
Else
tst3 = tst1
End If
MsgBox tst3

Devin

" wrote:

I would like to know how many days between two dates and time.
Exemple: 1 Dec 14:00 to 3 Dec 21:00, will be 2 days but I want to know
how many days it will when you go over 6 hours more than the 24 hours.
The exemple shown it will be 3 days.
You can reply via my email:




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default DAY BETWEEN TWO DATES AND TIME

Do I have to make a MACRO for this one?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default DAY BETWEEN TWO DATES AND TIME

This is give me 4 days not 3. Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default DAY BETWEEN TWO DATES AND TIME

Sorry, mi-read part, try

=INT(B1-A1)+(MOD((B1-A1),1)0.25)*1

instead

--
HTH

-------

Bob Phillips
"BonjourMonde" wrote in message
oups.com...
This is give me 4 days not 3. Thanks



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default DAY BETWEEN TWO DATES AND TIME

Thanks, it works.

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
Linking computer dates (time) to spreadsheet dates that have formu bigisle Excel Worksheet Functions 3 January 3rd 10 08:05 PM
Working with dates and time Inca New Users to Excel 5 December 10th 08 02:29 AM
Subtracting Dates to get total time work time excluding weekends Jon Ratzel[_2_] Excel Discussion (Misc queries) 2 January 31st 08 10:36 PM
Calculating time between two dates Gary''s Student Excel Discussion (Misc queries) 0 January 19th 07 08:13 PM
Time between two dates FA Excel Discussion (Misc queries) 4 August 24th 05 12:11 PM


All times are GMT +1. The time now is 01:29 AM.

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

About Us

"It's about Microsoft Excel"