Can someone please help me on getting a formula round off to the next highest .25.

example:

2.35->2.50
2.26->2.50
2.24->2.25
2.51->2.75

I can't use the Round function because if I have 2.26 then it will round off to 2.25 which is unacceptable.

I have been using the Ceiling function but it rounds it off to the nearest highest integer. Which can add an almost extra kg,lb to my formulas.

Recommended Answers

All 3 Replies

Nevermind Stupid me didn't realized this is super easy haha

Member Avatar

How did you do it? I quickly did it like this:

Dim d As Double = 2.51

d = Math.Floor(d) + (Math.Ceiling((d Mod 1) / 0.25) * 0.25)

Not as efficient as yours lol but easy as creating a function with if statements. I'll definitely use your code instead. Now if there was a way you could help me speed up my word automation.... anyways Thanks again, You've helped me so much with my program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.