DAY BETWEEN TWO DATES AND TIME

  • Thread starter Thread starter blouinjm
  • Start date Start date
B

blouinjm

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: (e-mail address removed)
 
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
 
Here is a formula solution

=INT(B1-A1)+1+(MOD((B1-A1),1)>0.25)*1
 
Sorry, mi-read part, try

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

instead
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top