ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   rounding out "time" (https://www.excelbanter.com/excel-programming/366510-rounding-out-time.html)

mark kubicki

rounding out "time"
 
this formula works for me when i need to round out a number to the nearest
1/4;
however,
when i need to round out time to the nearest 15 minutes, it does not... any
sugggestions?

Dim vTargetValue1 As Long
Dim vTargetValue2 As Double
Dim vTargetValue
Const BillingIncrement = 25
If target.Count = 1 Then
vTargetValue1 = target.Value \ BillingIncrement
vTargetValue2 = target.Value / BillingIncrement
If vTargetValue1 < vTargetValue2 Then
target.Value = (vTargetValue1 + 1) / 100 * BillingIncrement
End If
End If

thanks in advance,
mark




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

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