Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. excel - rounding time to the nearest 15 minutes
  2. D10=(C9-D9)*24
  3.        
  4. 1:53 until 2:07 would be counted as 2
  5. 2:08 until 2:22 would be 2:15
  6. 2:23 through 2:37 would be 2:30
  7. etc
  8.        
  9. i need the accrued time from 1 PM to 2:08 PM should round up to 1.25 hours whereas 1 PM to 2 PM would round down to 1 hour, in other words to the nearest quarter hour.
  10.        
  11. =(TRUNC((D9+VALUE("00:07"))*96)-TRUNC((C9+VALUE("00:07"))*96))*VALUE("00:15")*24
  12.        
  13. =MROUND((C9-D9)*24,0.25)
  14.        
  15. =(ROUND(+D9*96,0)-ROUND(+C9*96,0))/4
  16.        
  17. Public Function f(n As Double) As Double
  18.  
  19.     Dim d As Double, r As Double, x As Double
  20.  
  21.     d = Int(n / 0.25)
  22.     r = n - (d * 0.25)   ' strange... couldn't use mod function with decimal?
  23.     x = 0.25 * Round(r / 0.25)
  24.  
  25.     f = (d * 0.25) + x
  26.  
  27. End Function