View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Rounding Time down

On Feb 10, 1:05*am, "Vacuum Sealed" wrote:
Require help with the best way to structure a Script
to round down time to the nearest even 30 mins.
eg
10:15 = 10:00
14:45 = 14:30
etc.
Though
10:00 would still = 10:00 and
14:30 would still = 14:30
The time is always recorded in 15 min increments


It might help to know that numeric time is stored as a fraction of a
day. 1 hour is 1/24; 1 minute is 1/1440 (1440 = 24*60); and 1 second
is 1/86400 (86400 = 24*60*60).

So rather than taking advantage of the special assumption that time is
entered in 15-min increments, the more general way to round down to 30-
min increments is:

=FLOOR(A1*1440,30)/1440

formatted in the form you wish.