+ Reply to Thread
Results 1 to 6 of 6

Dynamic Decimal Places

  1. #1
    Registered User
    Join Date
    09-16-2008
    Location
    Chicago, IL
    Posts
    30

    Dynamic Decimal Places

    Hello,

    I have a table which has a number column (10 decimal places) and a precision column (0,1,2,3). I want to convert the number based on the corresponding precision value. I'm using the TEXT formula, however unable to reference it to the Precision column.

    Ex:

    Number - Precision - TEXT
    9.6566545665 - 3 - TEXT(A1,B1) should return 9.657

    I don't want to convert the precision to '0.000, I want to keep it as 0,1,2,3.

    Any help is greatly appreciated.

    Regards,
    Kalyan Verma

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Dynamic Decimal Places

    Why not:

    =ROUND(A1,B1)

    You can use TEXT but the above should be sufficient

    =TEXT(A1,"#."&REPT(0,B1))

    But the above would be a Text string...and if you want a number you should use ROUND as illustrated.

  3. #3
    Registered User
    Join Date
    09-16-2008
    Location
    Chicago, IL
    Posts
    30

    Re: Dynamic Decimal Places

    Awesome, Thanks a Million.

  4. #4
    Registered User
    Join Date
    09-16-2008
    Location
    Chicago, IL
    Posts
    30

    Re: Dynamic Decimal Places

    Ran into an Issue.

    What if my Precision is 0, it shows the value as "9."

    Regards,
    Kalyan Verma

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Dynamic Decimal Places

    If using TEXT:

    =0+TEXT(A1,"#"&IF(N(B1),"."&REPT(0,B1),""))

    or

    =ROUND(A1,B1) .....

  6. #6
    Registered User
    Join Date
    09-16-2008
    Location
    Chicago, IL
    Posts
    30

    Re: Dynamic Decimal Places

    Thanks, It worked.

+ 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