Date: prev next · Thread: first prev next last
2022 Archives by date, by thread · List index


Was the page I found that mentioned it, but other pages 
didn't mention the banking rounding? So not sure if excell 
would use regular rounding in excell, but uses the 
banking rounding if using the VBA? Don't have access to 
excell so no way to test, and might even vary depending 
on what version of excell and/or windows??


This VBA function returns something commonly 
referred to as bankers rounding. So be careful 
before using this function. For more predictable 
results, use Worksheet Round functions in Excel 

Note sure why neither Calc or Excell give option to select 
which type of rounding to use?

Made a test formula to do it.

That looked at 3 and 4 digits and would round down for 0 
to 49 and round up for 51 to 99. 50 would depend on the 
original digit to 2nd decimal being even or odd to 

Would work with just looking at 3 digit, and would do same for 0 to 4, and 6 to 
9, and then vary if 3rd was 5?

Might be another way, but that seemed to work..

On 5 Jun 2022 at 12:49, Johnny Rosenberg wrote:

From:  Johnny Rosenberg 
Date sent:60;Sun, 5 Jun 2022 12:49:42 +0200
Subject: ;Re: [libreoffice-users] ROUND function 
To: 0;LibreOffice Användare 

Den sön 5 juni 2022 kl 11:55 skrev Michael D. Setzer II <;

One windows excell page mentions that it uses the
banking rounding method, which I believe is the round to
nearest even. So, using that method 12.125 would round
to 12.12, while 12.135 would round to 12.14..> >

Oh, yes. I didn't think of that. Yes, that makes sense, and I remember we
learned that method in school too. So no bug report necessary, then\u2026 Unless
we want the documentation to be clearer on this.</div>>

Kind regards

Johnny Rosenberg

With this method if next digit is 1,2,3,4 the number> > rounds down. If it is 6,7,8,9 it rounds 
up. If 0 it does
nothing, but if it is 5, it has to check if the key pervious
digit is an even or old number. If it is even, then it rounds
down, if odd it rounds up.

The regular LibreOffice round uses the standard round

Usually, the standard round is used, but know that some
government regulations require the banking/roundeven> > or roundodd method.

Was surprized that excell's would default to banking?
Note sure why they don't provide one for each method, or
have an option to set.

On 5 Jun 2022 at 11:37, Johnny Rosenberg wrote:

From:                   Johnny Rosenberg
Date sent:        &#160;     Sun, 5 Jun 2022 11:37:04 +0200> > Subject:        60;       Re: 
[libreoffice-users] ROUND function
To:         &#160;           LibreOffice Användare

Looks like a bug to me. 12.125 returns 12.12, but 12.1251 returns 12.13.
Both should return the same.
I guess this bug should be reported.> > > Meanwhile, you can make your own function that you 
can use. Here are two
different suggestions.

1: This one use the Calc built-in ROUND() cell function. Place it in "My
macros & dialogs". VBA compatibility mode is not needed.

Public Function faRound(x As Double, d As Integer)
Dim Calc
faRound=Calc.callFunction("ROUND", Array(x, d))
End Function

2: This one use the method we learned at school:
Public Function fRound(x As Double, d As Integer)
End Function

Print afRound(12.125, 2)
Result: 12.13

Print fRound(12.125, 2)
Result: 12.13

Print fRound(12.125, 1)
Result: 12.1

... and so on.

Kind regards

Johnny Rosenberg

Den sön 5 juni 2022 kl 04:46 skrev Steve Edmonds <

I have just put a basic macro together so it will calculate income tax
due from our local tax rates.
I needed to round the tax to the nearest cent so taking the easy route
added Option VBASupport 1 to use the available VB round function.

I then noticed that the VB round function with say round(12.125,2)
rounds down to 12.12 and the LO inbuilt spread sheet function ROUND
ROUND(12.125,2) rounds up to 12.13.> > > >
Is rounding in this situation arbitrary or is there some some
for consistency.


To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
Privacy Policy:

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
Privacy Policy:

  Michael D. Setzer II - Computer Science Instructor
  Guam - Where America's Day Begins
  G4L Disk Imaging Project maintainer> >> > 

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:> Privacy Policy:

Michael D. Setzer II - Computer Science Instructor (Retired)   60;                      &#160;
Guam - Where America's Day Begins                    &#160;
G4L Disk Imaging Project maintainer

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
Privacy Policy:


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.