Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
rounding to the nearest half ( .5)
Hi
is it posible to use the rounding to round a calculation to the nearest half, ie 2.24 = 2 2.26 = 2.5 etc Kev |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
rounding to the nearest half ( .5)
Yes it is. In the round function specify the units rounded to after the
value being rounded (ie FLOOR(B5,.5)) " wrote: Hi is it posible to use the rounding to round a calculation to the nearest half, ie 2.24 = 2 2.26 = 2.5 etc Kev |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
rounding to the nearest half ( .5)
One way:
=ROUND(A1*2,0)/2 In article , wrote: Hi is it posible to use the rounding to round a calculation to the nearest half, ie 2.24 = 2 2.26 = 2.5 etc Kev |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
rounding to the nearest half ( .5)
Here is a user defined function for you. Plce the code in a module and you
are good to go Public Function RoundNearest(ByVal InputValue As Double, _ ByVal NearestValue As Double) As Double If Modulo(InputValue, NearestValue) = NearestValue / 2 Then RoundNearest = (InputValue + NearestValue - (Modulo(InputValue, _ NearestValue))) Else RoundNearest = (InputValue - Modulo(InputValue, NearestValue)) End If End Function Private Function Modulo(ByVal Number As Double, ByVal Divisor As Double) As Double Modulo = Number - Int(Number / Divisor) * Divisor End Function You can use it in your spreadsheet like this... =roundnearest(A1, .5) -- HTH... Jim Thomlinson " wrote: Hi is it posible to use the rounding to round a calculation to the nearest half, ie 2.24 = 2 2.26 = 2.5 etc Kev |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I round time down to the nearest half hour? | Excel Worksheet Functions | |||
Rounding Date to Next Half Year | Excel Discussion (Misc queries) | |||
I need a formula with rounding up & rounding down to the nearest . | Excel Worksheet Functions | |||
correct to the nearest half | New Users to Excel | |||
how do i round time to the nearest half a minute | Excel Discussion (Misc queries) |