RoundUp function in Access

Nick Hampu

New Member
Joined
Mar 15, 2004
Messages
6
I'm trying to round up a calculation that represents the minimum number of parts my customer needs to buy if there is a $150 minimum order. Say that the field [part price] reflects a cost of $6.50. Taking $150 / [part price] comes out to 23.076. I need to round up the remainder and show 24 in the [minimum order] field.

Thanks in advance

N.H.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
There's no built in function that I know of to do this sort of Rounding but here's a small function which should get you what you need:
Code:
Public Function fRound_Up(numArg As Single) As Long
If numArg = 0 Then
    MsgBox "You Cannot Divide By 0!", vbExclamation
Else
    If 150 / numArg > CInt(150 / numArg) Then
        fRound_Up = CInt(150 / numArg) + 1
    Else
        fRound_Up = 150 / numArg
    End If
End If
End Function

Public Function ftest_it()
MsgBox fRound_Up(6.5)
End Function
 
Upvote 0
Not tested! but I think this will do what you are after

= iif(int([minimum order]/ [part price]=[minimum order]/[part price]),[minimum order]/[part price],int([minimum order]/[part price])+1)

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,645
Messages
6,161,044
Members
451,682
Latest member
ogoreo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top