+ Reply to Thread
Results 1 to 6 of 6

adding leading 0s to the middle of a formula

  1. #1
    Forum Contributor
    Join Date
    10-05-2012
    Location
    Washington
    MS-Off Ver
    Excel 2013
    Posts
    110

    adding leading 0s to the middle of a formula

    Hello all. I have a workbook that auto generates a reference number. There is a macro that runs as well to generate some paperwork which is working fine, I am having trouble with the formatting of the reference number. What I have now is a number in row A that keeps increasing by 1. How I accomplish this is cell A3 would have "NCR18-001", then in A4 I have this formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    the result is NCR18-2. Is there a way to tweak this formula so that it generates NCR18-002?

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: adding leading 0s to the middle of a formula

    Please Login or Register  to view this content.
    The TEXT function converts a number to a text string in a specified format -- "000" requires that it be three digits long, so it will put leading zeros on if necessary.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: adding leading 0s to the middle of a formula

    another way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    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: adding leading 0s to the middle of a formula

    Enter in A3 and drag formula down for as far as you need.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A
    1
    2
    3 NCR18 -001
    4 NCR18 -002
    5 NCR18 -003
    6 NCR18 -004
    7 NCR18 -005
    8 NCR18 -006
    9 NCR18 -007
    10 NCR18 -008
    11 NCR18 -009
    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

  5. #5
    Forum Contributor
    Join Date
    10-05-2012
    Location
    Washington
    MS-Off Ver
    Excel 2013
    Posts
    110

    Re: adding leading 0s to the middle of a formula

    Thanks everybody for the quick replies. They all worked.

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: adding leading 0s to the middle of a formula

    You are welcome and thanks

    Have a nice day

+ 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: 2
    Last Post: 09-14-2016, 01:29 PM
  2. [SOLVED] Adding Leading Zeros
    By j_Southern in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-12-2014, 08:03 AM
  3. Adding Leading Zero's
    By mma3824 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2014, 02:27 PM
  4. [SOLVED] Adding in Information in the middle and end of the string
    By RaydenUK in forum Excel General
    Replies: 4
    Last Post: 05-13-2014, 12:28 PM
  5. Adding leading spaces
    By gcotterl@co.riverside.ca.us in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2006, 02:25 PM
  6. Adding a Macro in the middle
    By schlempyasst in forum Excel General
    Replies: 5
    Last Post: 05-10-2005, 03:59 PM
  7. Adding Leading Zeros to Text
    By Jenn in forum Excel General
    Replies: 4
    Last Post: 01-12-2005, 03:06 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