+ Reply to Thread
Results 1 to 4 of 4

How do I determine the number of digits in a cell

  1. #1
    Registered User
    Join Date
    09-04-2013
    Location
    richardson, tx
    MS-Off Ver
    Excel 20037
    Posts
    28

    How do I determine the number of digits in a cell

    I have a column of numbers formatted as text. I need to find cells with only 5 digits and prefix a leading "0". How do I prefix a leading "0" to a cell with 5 digits but not cells with 6 digits? Each cell will have either 5 or 6 digits. I need all numbers to have 6 digits

    Each cell contains the last 6 (or 5) digits of a longer serial number, which is also formatted as text. Right now, I am prefixing the "0" manually but this will get out of hand quickly.

    Any suggestions will be greatly appreciated.

    thank you
    Gandalf2524

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: How do I determine the number of digits in a cell

    Change column reference/starting row to suite.
    Please Login or Register  to view this content.

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How do I determine the number of digits in a cell

    Here is how you can do this by formula.

    Assuming your data in column "A"

    =TEXT(A1,"000000")

    This will add a leading "0" for cells with 5 digits.

    Also you can highlight data in column "A", go to Format Cells and select Custom and type in 000000
    This format will add leading "0" to cells with 5 digits.
    Last edited by AlKey; 09-04-2013 at 10:46 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Registered User
    Join Date
    09-04-2013
    Location
    richardson, tx
    MS-Off Ver
    Excel 20037
    Posts
    28

    Re: How do I determine the number of digits in a cell

    AlKey

    Your suggestion worked great. Thanks.

    Spencer

+ 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] Sum the digits of a single cell down to one number
    By Gavald229 in forum Excel General
    Replies: 9
    Last Post: 09-11-2012, 01:13 PM
  2. Method to determine digits needed to construct numbers
    By theedarkone in forum Excel General
    Replies: 16
    Last Post: 07-05-2012, 10:35 AM
  3. msgbox for negative answer and how to determine the number of significant digits
    By bmr8002 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2012, 08:56 PM
  4. Replies: 5
    Last Post: 12-08-2008, 11:47 AM
  5. Number of Digits in a cell.
    By pilotwings64 in forum Excel General
    Replies: 2
    Last Post: 01-18-2008, 05:24 PM

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