+ Reply to Thread
Results 1 to 7 of 7

Passing cell value with decimal-format

Hybrid View

Figdor Passing cell value with... 08-14-2012, 09:03 AM
K m Re: Passing cell value with... 08-14-2012, 09:07 AM
Figdor Re: Passing cell value with... 08-14-2012, 09:38 AM
DGagnon Re: Passing cell value with... 08-14-2012, 10:53 AM
Figdor Re: Passing cell value with... 08-14-2012, 01:06 PM
DGagnon Re: Passing cell value with... 08-14-2012, 02:07 PM
Pauleyb Re: Passing cell value with... 08-14-2012, 02:35 PM
  1. #1
    Registered User
    Join Date
    08-14-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Passing cell value with decimal-format

    Hello.

    I have a cell, A1 say, with value 0.1245433212 that I have rounded using the toolbar so that the cell now shows 0.12.

    In another cell I want to pass the rounded value of A1 by refering to its cell address, i.e. the number 0.12. However if I refer to the cell by for instance letting the formula for A2 be "My A1 value = "&A1 it will pop out "My A1 value = 0.1245433212" in cell A2.

    Is there a Excel function that can help me to pop out the rounded animal?

    I would like to control the rounding by rounding the original value in A1 and not use the ROUND()-function on A2. Of course, if there is a function to return how much my value in A1 is rounded that is just great.

    Best regards.

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Passing cell value with decimal-format

    Try fixed

    =fixed(a1,2)
    Click on star (*) below if this helps

  3. #3
    Registered User
    Join Date
    08-14-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Passing cell value with decimal-format

    Hey, thanks.

    But that is not solving my problem.I would like to control the decimals showing in A2 from the way A1 is rounded. I do not want to let the number of decimals be shown in any ROUND() og FIXED() function unless the decimal-number can be returned from A1 by some way (with a function for instance).

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Passing cell value with decimal-format

    you could use a custom function like this:

    Function DecRnd(c As Range)
        DecRnd = Format(c.Value, c.NumberFormat)
    End Function
    and in cell 2 you would enter something like this

    =DecRnd(A1)
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  5. #5
    Registered User
    Join Date
    08-14-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Passing cell value with decimal-format

    Good idea!! I got it working. Is there way that I can have my functions be automatically updated?? That is, I have defined my function getRoundedValue() which return the value that is shown in the cell.

    When I change the way the values are rounded in A1, the function doesn't recalculate to update A2.

  6. #6
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Passing cell value with decimal-format

    Try this

    Function DecRnd(c As Range)
        Application.Volatile
        DecRnd = Format(c.Value, c.NumberFormat)
    End Function

  7. #7
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Passing cell value with decimal-format

    This may be able to be reduced, but I think it is interesting:
    =--TEXT(A1,"#."&REPT("#",RIGHT(CELL("format",A1),1)))
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

+ 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