Rounding logic

Swerly

New Member
Joined
Dec 10, 2019
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hello, I am working with commissions and %'s and I have a rounding issue I cannot get "around" (pun intended)….

The formula I am working on is:
=45.90*15%
=6.885
Should = 6.88

=77.70*15%
=11.655
Should =11.66

I've used ROUND, CEILING, FLOOR and MROUND but no matter what combination, cannot get it to work.
One formula will work with one of them, but not the other.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
6.885 to 6.88 is rounding down
11.655 to 11.66 is rounding up

What is the logic behind the two approaches?
 
Upvote 0
Excel does "round half away from zero".

It appears that you want "round half to even", aka "banker's rounding".

The VB Round function does that. So you might enter the following function into a normal VBA module (not a worksheet object):

Function vbround(x As Double, p As Long) As Double
vbround = Round(x, p)
End Function

Caveat: VBA Round does not allow p<0.

There might be many Excel alternatives. IMHO, they are all fraught with risk due to 64-bit binary floating-point anomalies.

The following seems to work with positive values in A1:

=IF(AND(ISEVEN(INT(A1*100)), MOD(A1*100,1)=0.5), ROUNDDOWN(A1,2), ROUND(A1,2))
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,656
Latest member
earth

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