ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Working with times (https://www.excelbanter.com/excel-programming/289117-working-times.html)

Dave[_17_]

Working with times
 
Please Help,
I have 2 times say, 08:00:00 & 10:00:00, what i need to
do is find out how many 15 min are between 2 times (here there are 8).
I have managed this:
Range("Ae3").Value = ((Range("ad3").Value - Range("ac3").Value) / 0.25)
where d3 = 08:00:00 and c3 = 10:00:00 this gives the answer of 00:08:00. I
need to just extract the number 8 so I can use it in a for to nexrt loop, to
the show the 15 min intervals between the 2 dates ie 08:15:00, 08:30:00
,08:45:00 etc.
Or is there an easier way?

Thanks


Dave



Tom Ogilvy

Working with times
 
try this instead

Range("Ae3").Value = ((Range("ad3").Value - _
Range("ac3").Value) / TimeValue("00:15"))

to illustrate from the immediate window:

? (timevalue("10:00")-timevalue("8:00"))/timeValue("00:15")
8


--
Regards,
Tom Ogilvy


Dave wrote in message
...
Please Help,
I have 2 times say, 08:00:00 & 10:00:00, what i need

to
do is find out how many 15 min are between 2 times (here there are 8).
I have managed this:
Range("Ae3").Value = ((Range("ad3").Value - Range("ac3").Value) / 0.25)
where d3 = 08:00:00 and c3 = 10:00:00 this gives the answer of 00:08:00. I
need to just extract the number 8 so I can use it in a for to nexrt loop,

to
the show the 15 min intervals between the 2 dates ie 08:15:00, 08:30:00
,08:45:00 etc.
Or is there an easier way?

Thanks


Dave






All times are GMT +1. The time now is 05:56 PM.

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