+ Reply to Thread
Results 1 to 6 of 6

Thread: Increment with letters in front

  1. #1
    Registered User
    Join Date
    07-30-2010
    Location
    South Pole
    MS-Off Ver
    Excel 2010
    Posts
    93

    Increment with letters in front

    I have been using excel for ever and I love to make tables. I know how to make a formula for a sequence of numbers, but I was wondering how I could make a formula for a sequence of numbers and letters. I want to make a table like this:
    Serial# Product Stock Value Price
    XXX000 Apples 15 $1 $2
    XXX001 Bananas 15 $1 $3
    etc.
    XXY000 Pork 15 $1 $2
    XXY001 Beef 15 $1 $1.50
    etc.

    I am trying to format the first column. The serial would have three letters and three numbers. I would start the "chain" by entering the first three random letters followed by 000 and then a formula to increment the numbers from there. And I could recycle the formula for my next set of three letters (if I could get a "-" between the letters and numbers that would be perfect ie XXX-000, but it would just be cosmetic so not necessary). I know there must be away to do this short of entering the serials manually.

    Thank you for the help

    edit: Thanks so much!
    Last edited by janschepens; 08-28-2011 at 09:38 AM.

  2. #2
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,788

    Re: Increment with letters in front

    ="xxx-"&TEXT(ROW(A1)-1,"000")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Increment with letters in front

    PHP Code: 
    =Left(A4,3)&TExT(Right(A4,3)+1,"000"



  4. #4
    Registered User
    Join Date
    07-30-2010
    Location
    South Pole
    MS-Off Ver
    Excel 2010
    Posts
    93

    Re: Increment with letters in front

    Thank you so much! It worked you saved me some work

  5. #5
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,590

    Re: Increment with letters in front

    Can't you just enter the first value say XXY-000 then use the fill handle, (the small black square bottom right of the selected cell), to drag it down?
    If you need any more information, please feel free to ask.

    However, if this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody! ....
    Also
    If you are satisfied by any members response to your problem please consider using the small Star icon botom left of thier post to show your appreciation.

  6. #6
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,788

    Re: Increment with letters in front

    yes you can lol
    how about
    ="AA"&CHAR(65+FLOOR((ROW(A1)-1)/1000,1))&TEXT((ROW(A1)-1)-(1000*FLOOR((ROW(A1)-1)/1000,1)),"000")
    that will give from aaa000 down to aaz999
    26000 unique coded ref
    Last edited by martindwilson; 08-28-2011 at 10:18 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0