Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding to nearest 0.05 1

Status
Not open for further replies.

TLOTRfan

MIS
Feb 20, 2003
3
GR
Is it possible to round a number field to the nearest nickle? Similar to Excel's CEILING function?
 
You could use a formula something like:

Dim x as Number

x = 1.56

If Remainder (x, 0.05) < 0.025 Then
Formula = x - Remainder (x, 0.05)
Else
Formula = x + (0.05 - Remainder (x, 0.05))
End If

If you can have negative number than you will have to modify this slightly to work.
 
Nice formula Joe. I couldn't wrap my brain around this one. It seems so simple now. Mike
If you're not part of the solution, you're part of the precipitate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top