+ Reply to Thread
Results 1 to 4 of 4

Rounding Formula

Hybrid View

  1. #1
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249

    Rounding Formula

    Hi,

    I am wondering if anyone can help me with the following statement.

    I have a number (example 1.068501) which i need to round up to 3 decimal places or 4 significant figures if the number is greater than 1 so the result would be 1.069.

    If the number was (example 0.926145) then we need to round up to 4 decimal places or 4 significant figures so the result would be in this example would be 0.9262.

    Can someone please provide me with a formula for this sort of calculation as I have a spreadsheet of over 500 numbers!

    Cheers in advance
    McCrimmon

  2. #2
    Marcelo
    Guest

    RE: Rounding Formula

    =round(a1,3)

    hth
    regards from Brazil
    Marcelo

    "mccrimmon" escreveu:

    >
    > Hi,
    >
    > I am wondering if anyone can help me with the following statement.
    >
    > I have a number (example 1.068501) which i need to round up to 3
    > decimal places or 4 significant figures if the number is greater than 1
    > so the result would be 1.069.
    >
    > If the number was (example 0.926145) then we need to round up to 4
    > decimal places or 4 significant figures so the result would be in this
    > example would be 0.9262.
    >
    > Can someone please provide me with a formula for this sort of
    > calculation as I have a spreadsheet of over 500 numbers!
    >
    > Cheers in advance
    >
    >
    > --
    > mccrimmon
    >
    >
    > ------------------------------------------------------------------------
    > mccrimmon's Profile: http://www.excelforum.com/member.php...fo&userid=6338
    > View this thread: http://www.excelforum.com/showthread...hreadid=555957
    >
    >


  3. #3
    MartinW
    Guest

    Re: Rounding Formula

    Hi mccrimmon,

    Try =IF(A1>=1,ROUND(A1,3),ROUND(A1,4))

    HTH
    Martin



  4. #4
    bplumhoff@gmail.com
    Guest

    Re: Rounding Formula

    Hello,

    We discussed this in the German newsgroup recently.

    Easiest presentation (worksheet function) seems to be:
    =TEXT(A1,"0.000E+000")

    Or you might want to use my UDF:

    Function dbl2nsig(d As Double, _
    Optional n As Long = 4) _
    As String
    'Returns string presentation of d with
    'n significant digits. PB V0.01
    Dim i As Long, j As Long
    Dim s As String, sr As String
    s = Format(d, "0." & String(n - 1, "0") _
    & "E+000")
    i = Right(s, 4)
    Select Case i
    Case Is > n - 2
    sr = Left(s, 1)
    If n > 1 Then sr = sr & Mid(s, 3, n - 1)
    sr = sr & String(i - n + 1, "0")
    Case 0
    sr = Left(s, n + 1)
    Case Is < 0
    sr = "0." & String(-1 - i, "0") & Left(s, 1) _
    & Mid(s, 3, n - 1)
    Case Else
    s = Left(s, 1) & Mid(s, 3, n - 1)
    sr = Left(s, i + 1) & "." & _
    Right(s, n - i - 1)
    End Select
    dbl2nsig = sr
    End Function

    HTH,
    Bernd


+ 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