Roundup

  • Thread starter Thread starter Harvey
  • Start date Start date
H

Harvey

Can anyone help with this problem. I have a report with
one section adding up the total cost of materials, which
is fine, and say the answer is £35.79. My question is,
how do I round it up to the next £5.00 to get an answer
of £40.00.

Thank's Harvey
 
Can anyone help with this problem. I have a report with
one section adding up the total cost of materials, which
is fine, and say the answer is £35.79. My question is,
how do I round it up to the next £5.00 to get an answer
of £40.00.

Thank's Harvey

One possible solution:
IIf(A / 5 = A \ 5, A, (A \ 5 + 1) * 5)

HTH,
Randy
 
Good Day!

Here is another way to round a number by building your own
function and then calling it to return the answer.

Public Function RoundANumber(InputNumber As Double,
NearestWhat As Double)

RoundANumber = Int(InputNumber / NearestWhat + 0.5) *
NearestWhat

End Function

In your example you would call it as:

RoundANumber(35.79,10)

And it would return 40.

RoundANumber(35.79,0.1) would return 35.8

Good Luck!
 
Thank you Dan. Works fine apart from one thing. For some
reason, anything just over 20 revert's to 20 instead of
25. All the other examples I tried work's fine.

Thank again Harvey
 
Back
Top