# Roundup to the nearest 5?

So 100 would stay 100,

101, 102, 103, 104 would become 105,

105 would stay 105,

106, 107, 108, 109 would become 110

and 110 would stay 110.

:?:Round(Number [, N]): If N is omitted or 0, Number is rounded to the nearest integer. If N is positive number, Number is rounded to N decimal places. If N is negative, Number is rounded by N digits to the left of the decimal point. For example, Round(345, -1) is 350 and Round (345, -2) is 300. Unlike Transform Round, the result has no .000 suffix whenever N is omitted or less than 1. In v1.0.44.01+, a value of N greater than zero displays exactly N decimal places rather than obeying SetFormat. To avoid this, perform another math operation on Round()'s return value; for example: Round(3.333, 1)+0.

Nevermind, this wouldn't keep your '105' at 105, but I left it up instead of ereasing it incase it was still of value to you.

rem := Mod(num, 5) rnd_amount := 5 - rem If (rnd_amount=5) rnd_amount = 0 ;so 100 stays at 100 rounded := num + rnd_amount

[color=red]Rounded[/color] := [color=darkred]Original[/color] + ( 5 - Mod([color=darkred]Original[/color],5) ) ; OR [color=violet]Number[/color] += ( 5 - Mod([color=violet]Number[/color],5) )

~~-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------~~**Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org**

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.