+ Reply to Thread
Results 1 to 3 of 3

Rounding, sig figs and the rule of evens

Hybrid View

skrimpy Rounding, sig figs and the... 02-20-2005, 09:41 AM
skrimpy I should clarify "rule of... 02-20-2005, 09:49 AM
skrimpy Sorry. I'm stupid. I need it... 02-20-2005, 10:24 AM
  1. #1
    Registered User
    Join Date
    09-22-2004
    Posts
    35

    Rounding, sig figs and the rule of evens

    I am using this cell formula to round a given number to 4 sig figs.
    =ROUND(Value,4-1-INT(LOG10(ABS(Value))))

    I have seen similar VBA code to round to a given number of sig figs (below)
    Does anyone know a way to modify this such that excel will round to a given number of sig figs using the rounding rule of evens? Or better yet, a cell formula that will round to a given number of sig figs using the rule of evens?

    Function ROUNDSIG(num As Variant, sigs As Variant)
    Dim exponent As Double
    If IsNumeric(num) And IsNumeric(sigs) Then
    If sigs < 1 Then
    ' Return the " #NUM " error
    ROUNDSIG = CVErr(xlErrNum)
    Else
    exponent = Int(Log(Abs(num)) / Log(10#))
    ROUNDSIG = WorksheetFunction.Round(num, _
    sigs - (1 + exponent))
    End If
    Else
    ' Return the " #N/A " error
    ROUNDSIG = CVErr(xlErrNA)
    End If
    End Function

  2. #2
    Registered User
    Join Date
    09-22-2004
    Posts
    35
    I should clarify "rule of evens". By this I do not mean Microsofts "Banker's rounding". By rule of evens I mean the rule by which if the last digit is a 5, look to the next digit to decide. If that next digit is an even number round it up and drop the 5. If it is odd, leave that digit and drop the 5.

  3. #3
    Registered User
    Join Date
    09-22-2004
    Posts
    35
    Sorry. I'm stupid. I need it to round up when the second to last digit is odd and this is the same thing as "bankers rounding".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1