+ Reply to Thread
Results 1 to 7 of 7

Max 2 decimal places for result / Integers 0 decimal places

  1. #1
    Registered User
    Join Date
    12-18-2018
    Location
    Phuket, Thailand
    MS-Off Ver
    Windows 11 - MS Office 365
    Posts
    88

    Max 2 decimal places for result / Integers 0 decimal places

    Hi there,

    I would like to know how to limit a number to a max of 2 decimals and allow for integers and 1 decimal numbers to be displayed accordingly.

    For example, here is a data set.

    - 1.3532
    - 5
    - 3.1
    - 7.166343
    - 6.2
    - 7

    The result is as follows:

    - 1.35
    - 5
    - 3.1
    - 7.17
    - 6.2
    - 7

    Is this possible? If the 1 decimal numbers need to be 2, that would be acceptable.

    Thank you,

    Danny

  2. #2
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: Max 2 decimal places for result / Integers 0 decimal places

    Format your cells: 0.##

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Max 2 decimal places for result / Integers 0 decimal places

    HansDouwe's solution is by far the easiest. However, many users in the past have been unsatisfied with that solution because it shows a decimal point behind integers. In order to get exactly what you show in the OP, you will probably end up using conditional formatting to choose between format codes of "0" and "0.##" based on a formula that tests whether the value is an integer or not.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: Max 2 decimal places for result / Integers 0 decimal places

    Nice addition MrShorty. I learned something again.

  5. #5
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: Max 2 decimal places for result / Integers 0 decimal places

    I'll respond, because I saw that you opened a new tread today with the same question and I wonder why you didn't respond to our input here.
    If you don't respond, we don't know if our answers are clear.

    Carrying out Mr Shorty's advice above.
    Give the cells custom format 0.0# and add the Conditional format rule =(A1=INT(A1)) with format General.

    I would like to hear your feedback.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-18-2018
    Location
    Phuket, Thailand
    MS-Off Ver
    Windows 11 - MS Office 365
    Posts
    88

    Re: Max 2 decimal places for result / Integers 0 decimal places

    Thank you guys. The solution works as desired.

    And sorry about the second post with the same question! I'll be sure to check my library of previous posts before posting again.

    Danny

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: Max 2 decimal places for result / Integers 0 decimal places

    Hi Danny,

    Nice to hear that the solution works with 0, 1 or 2 decimals?
    Would you consider adding reputation to the answers you feel deserve?
    This can be done by clicking on Add reputation at the bottom left of the answer.

+ 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. Replies: 4
    Last Post: 07-09-2022, 12:23 PM
  2. Adusting decimal places based on greatest number of places in a series
    By anelson87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2022, 01:05 PM
  3. [SOLVED] Calculating decimal places in a non decimal format (ie sixes not tens)
    By Mike Brewer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-07-2013, 08:58 AM
  4. Paste two decimal number in excel without extra decimal places appearing
    By jeffery_frick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 07:49 PM
  5. Replies: 4
    Last Post: 06-10-2009, 12:50 PM
  6. Format Result Of Date Diff To 2 Decimal Places
    By Reafidy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-27-2007, 04:59 PM
  7. [SOLVED] FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT.
    By SUKYKITTY in forum Excel General
    Replies: 3
    Last Post: 07-06-2005, 09:05 AM

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