+ Reply to Thread
Results 1 to 6 of 6

Cell will not display limited decimal places

  1. #1
    Registered User
    Join Date
    05-30-2015
    Location
    Miami, Florida
    MS-Off Ver
    Excel 2010 for Windows
    Posts
    2

    Question Cell will not display limited decimal places

    Hello,

    I am working on a spreadsheet to analyze voting data, and I have run into an annoying snag. I have several fields in which I'd like the values to only include 2 decimal places -- clearly, an easy thing to do.... However, I am finding that some values seem to be ignoring the "2 decimal places" format, and displaying the entire string of decimal places. I have noticed that this is only occurring where I have formulas that can return either text or numerical values. In those cases, when the formula returns a numerical value, it does treat the value as a number (i.e., I can run calculations on it), but it will not let me limit decimal places in the output cells (or on the subsequent calculations).

    Any thoughts? Here's an example of one of the formulas:
    =IF(C13="Viable", 1, "") & IF(C13="Excluded", 1, "") & IF(AND('Round 1'!$A$4="Surplus", C13="Elected"), D13*'Round 1'!$A$10, "")

    Thanks!
    Greg

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

    Re: Cell will not display limited decimal places

    Assuming the formula returns a number and not text, format the result as 0.00.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Cell will not display limited decimal places

    Quote Originally Posted by gscooper View Post
    I have several fields in which I'd like the values to only include 2 decimal places [...]. However, I am finding that some values seem to be ignoring the "2 decimal places" format, and displaying the entire string of decimal places. [....] Here's an example of one of the formulas:
    =IF(C13="Viable", 1, "") & IF(C13="Excluded", 1, "") & IF(AND('Round 1'!$A$4="Surplus", C13="Elected"), D13*'Round 1'!$A$10, "")
    The formula returns text. The cell numeric format applies only to numeric results, not to text. Ostensibly, change the formula as follows:
    Please Login or Register  to view this content.
    However, I wonder if the following formula is really what you intended:
    Please Login or Register  to view this content.
    In that case, the cell formula Number with 2 decimal places should do what you want -- as long as 1.00 is okay when C13 is "Viable" or "Excluded".

  4. #4
    Registered User
    Join Date
    05-30-2015
    Location
    Miami, Florida
    MS-Off Ver
    Excel 2010 for Windows
    Posts
    2

    Re: Cell will not display limited decimal places

    Thanks! Actually, your suggestions gave me a different idea, which worked -- I just put a VALUE function around the entire formula, and that solved it!
    Best,
    Greg

  5. #5
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Cell will not display limited decimal places

    Quote Originally Posted by gscooper View Post
    Here's an example of one of the formulas:
    =IF(C13="Viable", 1, "") & IF(C13="Excluded", 1, "")
    & IF(AND('Round 1'!$A$4="Surplus", C13="Elected"), D13*'Round 1'!$A$10, "")
    Quote Originally Posted by joeu2004 View Post
    Ostensibly, change the formula as follows:
    Please Login or Register  to view this content.
    However, I wonder if the following formula is really what you intended:
    Please Login or Register  to view this content.
    Quote Originally Posted by gscooper View Post
    Thanks! Actually, your suggestions gave me a different idea, which worked -- I just put a VALUE function around the entire formula, and that solved it!
    I presume you mean:
    Please Login or Register  to view this content.
    In that case, not only is VALUE unnecessary, but also it is incorrect in some circumstances.

    Your original formula returns the null string ("") under some conditions. Note that VALUE("") returns a #VALUE error.

    If you always want a numeric result or the null string, my second suggestion is the most direct way to implement the intended logic.

    PS.... I used OR() to combine two conditions of your original formula because they both return the same value (1). But since that is only "an example", it might be better for you to see the more general revision, to wit:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,605

    Re: Cell will not display limited decimal places

    @ joeu Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Display value in textbox format decimal places
    By alex3867 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2007, 07:20 AM
  2. How many decimal places can a cell display?
    By Spaz in forum Excel General
    Replies: 9
    Last Post: 04-03-2006, 03:40 PM
  3. How many decimal places can a cell display?
    By Spaz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-03-2006, 03:40 PM
  4. [SOLVED] [SOLVED] How many decimal places can a cell display?
    By Spaz in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-03-2006, 03:35 PM
  5. Formatting a cell to display varying decimal places.
    By JayE in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-21-2005, 07:06 PM

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