+ Reply to Thread
Results 1 to 7 of 7

Custom Number format

  1. #1
    Forum Contributor
    Join Date
    05-07-2007
    Location
    Singapore
    MS-Off Ver
    2006/2016
    Posts
    170

    Custom Number format

    Is there any catch all custom number formatting that will give me the below results

    3-> 3
    3.5-> 3.5
    3.33333333-> 3.33

    I messed around with various combinations of 0, # and ? and couldn't get it
    Last edited by lordfa9; 02-02-2019 at 01:34 AM.

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Custom Number format

    conditional number format
    1. =MOD(A1,1)=0
    2. =AND(LEN(MOD(A1,1)*10)=1,MOD(A1,1)>0)
    3. =LEN(MOD(A1,1)*10)>1
    Attached Files Attached Files
    Last edited by tim201110; 02-02-2019 at 07:44 AM.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Custom Number format

    Sorry for off-topic interjection:

    Tim - may I remind you that although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Custom Number format

    Why use 3 conditional formatting rules, Tim? You only need 1.

    Formatting cells as general, then applying CF rule

    =MOD(A1,1)

    With a custom format of 0.##

    Where A1 is replaced with the reference cell of the 'Applies to' range, will do as the OP has asked.

  5. #5
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Custom Number format

    deleted by tim
    Last edited by tim201110; 02-02-2019 at 09:33 AM.

  6. #6
    Forum Contributor
    Join Date
    05-07-2007
    Location
    Singapore
    MS-Off Ver
    2006/2016
    Posts
    170

    Re: Custom Number format

    Quote Originally Posted by jason.b75 View Post
    Why use 3 conditional formatting rules, Tim? You only need 1.

    Formatting cells as general, then applying CF rule

    =MOD(A1,1)

    With a custom format of 0.##

    Where A1 is replaced with the reference cell of the 'Applies to' range, will do as the OP has asked.
    I tried 0.## it doesnt work for me because it makes 3 appear as 3.

    UPDATE: googled around and apparently that is a common problem. Hope I don't have to use TRUNC
    Last edited by lordfa9; 02-02-2019 at 09:35 AM.

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Custom Number format

    Quote Originally Posted by lordfa9 View Post
    I tried 0.## it doesnt work for me because it makes 3 appear as 3.
    Not if you do it the way I suggested.

    Format the cells as 'General'

    Format the decimals as 0.## by using conditional formatting with the rule =MOD(A1,1) with A1 adjusted to match your data range.

+ 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: 6
    Last Post: 12-08-2018, 09:26 PM
  2. Need formula or code to convert number(s) from custom format to number format
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-12-2015, 07:44 PM
  3. Custom Number Format
    By Frank Curry in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2013, 05:06 AM
  4. Custom number format
    By Boris. in forum Excel General
    Replies: 5
    Last Post: 10-29-2008, 11:38 AM
  5. how do I add phone number format as a permanent custom format?
    By frustratedagain in forum Excel General
    Replies: 3
    Last Post: 02-03-2006, 11:52 PM
  6. Format a cell with a custom number format
    By Armor in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-29-2006, 07:30 PM
  7. Custom number format always defaults last number to 0.
    By scubadave in forum Excel General
    Replies: 2
    Last Post: 06-15-2005, 06:05 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