+ Reply to Thread
Results 1 to 5 of 5

Fixed Character Count (custom format for Numbers)

  1. #1
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Manila, Philippines
    MS-Off Ver
    2019
    Posts
    102

    Fixed Character Count (custom format for Numbers)

    Gurus, I would appreciate your help with this challenge. For some reason, the requirement calls for rows of numbers that have fixed number of characters, discounting decimal points. For example, if I type 23.5 in a cell and the requirement calls for 4-digit characters only, the cell would return 23.50 (4 characters excluding the decimal point). Next if I type 523.596, the cell would return 523.6 (again 4 characters excluding decimal point). For more examples, allow me to illustrate (see attached image).

    table.jpg

    I tried the Custom format for Numbers by using 0000 in Format Cells (CTRL+1) but it yields output not the one I need. Thanks in advance!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Fixed Character Count (custom format for Numbers)

    I don't know of any way to do this IN THE SAME ORIGINAL CELL using number formats. But you can get your results in an adjacent cell using formulas.

    Data Range
    A
    B
    C
    1
    11.5
    11.50
    =IF(A1<10,TEXT(A1,"0.000"),IF(A1<100,TEXT(A1,"00.00"),TEXT(A1,"000.0")))
    2
    1.5
    1.500
    3
    255.3
    255.3
    4
    0.25
    0.250
    5
    230.5
    230.5
    6
    18.02
    18.02
    7
    523.596
    523.6
    8
    23.5
    23.50
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Fixed Character Count (custom format for Numbers)

    Hello,
    You can use conditional formatting in the cells to set the number formatting based on the cell value
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Registered User
    Join Date
    05-04-2017
    Location
    MALAYSIA
    MS-Off Ver
    2007
    Posts
    34

    Re: Fixed Character Count (custom format for Numbers)

    Quote Originally Posted by pike View Post
    hello,
    you can use conditional formatting in the cells to set the number formatting based on the cell value
    that is great solution

  5. #5
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Manila, Philippines
    MS-Off Ver
    2019
    Posts
    102

    Re: Fixed Character Count (custom format for Numbers)

    Combining the suggestions/solutions presented by @pike and @JBeaucaire, I was able to achieve the desired output. It works perfectly the way I want it. Thank you very much, gentlemen!!

+ 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: 09-08-2016, 01:35 PM
  2. How do a format numbers in a custom way?
    By christinaAnnmerkle in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-29-2016, 10:51 AM
  3. custom format for numbers
    By elmasguapo in forum Excel General
    Replies: 3
    Last Post: 11-10-2015, 08:17 PM
  4. [SOLVED] Fixed display custom format
    By Jhon Mustofa in forum Excel General
    Replies: 7
    Last Post: 02-19-2014, 09:59 PM
  5. [SOLVED] Merging Numbers with custom format - how to keep format
    By oddcarout in forum Excel General
    Replies: 3
    Last Post: 08-15-2012, 07:54 PM
  6. [SOLVED] Custom Format for Numbers
    By Dr. Sachin Wagh in forum Excel General
    Replies: 4
    Last Post: 01-14-2006, 01:50 AM
  7. Replies: 1
    Last Post: 02-18-2005, 10:06 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