+ Reply to Thread
Results 1 to 15 of 15

If x.0 do not show decimal or zero; if x.5 show on worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Question If x.0 do not show decimal or zero; if x.5 show on worksheet

    Hello,

    I have a summary worksheet with calculation from another worksheet. There will be one to several digits to the left of decimal. There will either be a zero or 5 after the decimal.
    If xx.0, I do not want to see the decimal or zero. Is this possible?

    TIA.
    Regards,
    Jan

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,391

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    A number format code of 0.# will not show the 0, but will show the decimal point (13.0 will display as 13.). In order to not show both the zero nor the decimal point (to display 13.0 as 13) you will need to use conditional formatting. Your conditional formatting will test for "integer" (probably something like =INT(A1)=ROUND(A1,1)) If your test for integer is TRUE, then format code is 0. If your test for integer is FALSE, then format as 0.0.

    https://support.office.com/en-us/art...B-F1951FF89D7F
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Thank you. For now I guess I will use number formatting as 0.#. I tried the integer in conditional formatting and if true to format cell as white. It formatted the whole cell as white. Yes, I did change cell reference to my specific cell on worksheet.

    Kind regards,
    Jan

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    You could try a formula like this in cell B1 if the value you wish to change is in cell A1

    =IF(A1-INT(A1)=0.5,A1,INT(A1))
    Alf

  5. #5
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Thanks for the tip, but I don't want to add any more columns. I would then have to hide the other column that shows 0.0. This is going to be used every one my manager and I can't have them trying to hide columns, etc.

    Regards,
    Jan

  6. #6
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Per attached, I entered the formula =INT(A1)=ROUND(A1,1)) noted above under conditional formatting, but it gives me an error message.
    Attached Images Attached Images

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,391

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    It does not give me an error message. What is the error message?

  8. #8
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Hi Mr Shorty,

    See attached error message. Please note I changed column/cell from a1 to d4, etc to match my actual date.

    Kind regards,
    Jan
    Attached Images Attached Images

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,391

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    I don't see anything wrong with the formula, unless your Excel installation/language setting specify to use semicolon ; instead of comma , to delimit formula arguments [ROUND(D4;1)]. Does that formula work in a spreadsheet cell?

  10. #10
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Hi Shorty,

    The language is not the problem because when I use the semi-colon, I get an error.
    I put =Round(d4,1) and have attached the result. I still get 11.0.
    Please noted that all these cells are calculating data from another worksheet(same workbook). Could that be the problem?

    Regards,
    Jan
    Attached Images Attached Images

  11. #11
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    you have extra Close parenthesis in the round (referring to post #6)
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  12. #12
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Quote Originally Posted by janljan View Post
    Hello,

    I have a summary worksheet with calculation from another worksheet. There will be one to several digits to the left of decimal. There will either be a zero or 5 after the decimal.
    If xx.0, I do not want to see the decimal or zero. Is this possible?
    I'm confused. If you format the cells to GENERAL, then values like 24.5 will appear as 24.5 and 24.0 will appear as 24 (no decimal point). Is that what you are looking for?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  13. #13
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Hello,

    In regards...."I'm confused. If you format the cells to GENERAL, then values like 24.5 will appear as 24.5 and 24.0 will appear as 24 (no decimal point). Is that what you are looking for? "
    Yes, that is what I am looking for but If I use general, the cells that have a value of 0 show as 0. If the calculation result is 0, I don't want to see the zero on worksheet.

    TIA.

    Regards,
    Jan

  14. #14
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Try this custom format
    Select the cells in your range>Format cells> Number>Custom
    General;-General;
    zeros will not appear. decimal points will only appear as necessary

  15. #15
    Registered User
    Join Date
    04-04-2017
    Location
    LEMONT
    MS-Off Ver
    Office 13
    Posts
    50

    Re: If x.0 do not show decimal or zero; if x.5 show on worksheet

    Fantastic! That was perfect.

    TIA
    Jan

+ 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. [SOLVED] How to show decimal in percentage when it not a whole
    By elevenkun in forum Excel General
    Replies: 6
    Last Post: 02-14-2017, 12:20 AM
  2. [SOLVED] Turn a fraction around, then show it as a decimal
    By tom hatten in forum Excel General
    Replies: 5
    Last Post: 01-17-2016, 01:22 PM
  3. VBA script - need the end product in worksheet to show decimal places
    By robldneast in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2012, 08:12 AM
  4. Replies: 4
    Last Post: 09-06-2012, 07:51 AM
  5. How to show decimal position to two and then show them as only digits?
    By Ning in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 09:25 AM
  6. how to show two decimal points
    By associates in forum Excel General
    Replies: 3
    Last Post: 10-12-2006, 04:11 AM
  7. How Show decimal in Bar Function
    By Babba in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2005, 11:05 AM

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