ROUNDUP and ROUNDDOWN FUNCTION errors

32CARDS

Board Regular
Joined
Jan 1, 2005
Messages
123
A UDF function seems to interfere sometimes with the rest of the workbooks entire process for some reason.

I could use the CEILNG function to work around the glitch, but it does not seem to allow the flexibility required because it takes everything to 1.
So for example if a Value is 9.24, CEILING will Sum to 10 when when it must be 9, unless I'm missing something.
But if the Value is 9.25 or 9.26 then rounded value must go to 10


The basic math required in the formula bar then is:
x = the value in Cell range.

if (x < 0.25) then x = 0
if (x >= 0.25) and (x < 0.75) then x = 1 ' or 5
if (x >= 0.75) then x = 1

x values appear in cell ranges:
J9,J10 and J11

The rounded Values of those Cell Ranges are in:
R9,R10 and R11

The question is,
How is the correct Syntax of that above ROUNDUP/ROUNDOWN written so it works in the Formula bar instead ?

The other question is then, why would a UDF ROUNDING Function mess with the entire process of the workbook's other macros, even if I place the UDF in a VBA module on it's own ?

Much prefer though to use the Formula bar instead though if possible.


Thanks in advance.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Thanks,
1 ' or 5 is the choice to make adjustments,
so I could change it if Value = 9.52 it will show 9.50 and not 10

The UDF shown to me to try is

Function ROUNDPAY(Pay)
Dim x
If Pay - Int(Pay) < 0.25 Then
x = 0
Else
x = 1
End If

ROUNDPAY = Int(Pay) + x
End Function
 
Upvote 0
If you want to round-up if >0.24 else round-down :-

=(A7-INT(A7)>0.24)+ROUNDDOWN(A7,0)

If you want to round to nearest 0.50 :-

=MROUND(A7,0.5)
 
Upvote 0
Boller, thanks for you reply,
I can see your solution, but there are approximately 150 seperate calculations done per hour and each process is not the same as the previous.
So the Values are not a constant 0.24 etc
 
Upvote 0
Boller, thanks for you reply,
I can see your solution, but there are approximately 150 seperate calculations done per hour and each process is not the same as the previous.
So the Values are not a constant 0.24 etc

I don't understand what this means.
 
Upvote 0
Boller,
where you have >0.24

=(A7-INT(A7)>0.24)+ROUNDDOWN(A7,0)

I assumed you thought I may have meant the 0.24 is constant ?

But I might be wrong to in understanding your solution, my apologies.

I'll try and test both methods and see how it goes and post back.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

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