+ Reply to Thread
Results 1 to 6 of 6

Custom formatting code - rounding problem

  1. #1
    Registered User
    Join Date
    08-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question Custom formatting code - rounding problem

    I hope I am in a right forum.. else please re-direct or move this thread to a right one..


    Here the problem raises with rounding the two decimal values. But i need like using trunc in custom formatting. I need the values not to get rounded with decimal but display as it was.

    Problem 1

    [>=1000000]$#0.00,, "M";[>=100000]$#0.00, "K";$#.00

    this code converts millions and K with 2 decimals but it is rounding the first two digits

    Values:106,008,784.41 69158976 36849808.41

    Expected: 106.00 69.15 36.84
    Actual: 106.01M 69.16M 36.85M


    Problem 2

    [>0] +##%;[<0]-##%;0

    this code works as if it greater than 0 say 1, then display as +100% , lesser than 0 say -1 then -100% else 0

    but when it goes without values when between (0.9 , -0.9) it result + % if the values between (+0.9,0) and -% if between (+0.9,0)

    To say simply problem comes when it comes lesser than 1% having values say 0.009 it is not showing any values so let us round to 0.

    Suggestions and codes are welcomes, thanked and highly appreciated.


    Thanks in advance.
    venky

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Custom formatting code - rounding problem

    Formatting always rounds for display. You could use formulas if you need to truncate.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Custom formatting code - rounding problem

    Thanks for ur time..

    Could you please give some more details on this.. I am not versed in excel ..

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Custom formatting code - rounding problem

    Please Login or Register  to view this content.
    The formula in B1 and copied down is

    =LOOKUP(A1, {0,100000,1000000}, TRUNC(A1/10^{0,3,6}, 2))

  5. #5
    Registered User
    Join Date
    08-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Custom formatting code - rounding problem

    Thanks for ur time shg!
    I can use trunc function referring a cell manually .. but the problem is , in need of custom formatting code and without referring any columns

    like

    [>=1000000]$#0.00,, "M";[>=100000]$#0.00, "K";$#.00

    here i havent mentioned any cell as A1 so and soo..

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Custom formatting code - rounding problem

    As I said in my earlier post, you cannot do this with formatting.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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