+ Reply to Thread
Results 1 to 16 of 16

Formula for sequential ID with letters and numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    05-11-2022
    Location
    Scotland
    MS-Off Ver
    MS Office 365
    Posts
    8

    Formula for sequential ID with letters and numbers

    Formula for sequential ID with letters and numbers
    Hi All

    My first post here so apologies if I get something wrong! I currently have a table within Excel 365 that records projects. Each project has a unique sequential ID. To get the table to autofill each new row I need a formula in the project ID that can be carried over, however all my tries of using a various of formulas ROW, TEXT, SEQUENCE, CONCATENATE etc. has failed. I can't use a vlookup either from another worksheet as the info is moved between workbooks and sent out to external parties which would break the link.

    The code is as follows: SOP0001, SOP0002, SOP0003… however when it gets to 10 we drop a zero eg SOP0010, SOP0011, SOP0012… then drop another at 100 eg SOP0100, SOP0101…. And because there is this drop of the zero manually it doesn’t recognise a constant formula so won't autofill a new row.

    This spreadsheet is to be set up for someone with MINIMUM excel experience so if I can get it to automate and lock the formula there should be no issue of accidental duplication of IDs which has had happened more than once already. Using Macros or VBA codes is a big no no so any help would be greatly appreciated!

    Additional Info - The columns may be sorted by A-Z and so the ID needs to stick with the data; the formula provided so far hasn't worked. I have attached a sample of data. It is the first column I need to automate - the Project ID. Thank you
    Attached Files Attached Files
    Last edited by mbowick; 05-20-2022 at 07:07 AM. Reason: not enough information for response

  2. #2
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    You can do this easily with custom number formatting.

    in A2 (assuming that A1 contains a blank or text):

    =IFERROR(A1+1,1)

    Custom formatting:

    "SOP"0000

    An alternative without custom formatting would be this:

    =IFERROR("SOP"&TEXT((A1+1),"0000"),"SOP"&TEXT(1,"0000"))

    The disadvantage of this option is that the ID is seen as text, whereas the first option is a number.
    Attached Files Attached Files
    Last edited by AliGW; 05-13-2022 at 04:23 AM. Reason: Extra option added to workbook.
    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.

  3. #3
    Registered User
    Join Date
    05-11-2022
    Location
    Scotland
    MS-Off Ver
    MS Office 365
    Posts
    8

    Re: Formula for sequential ID with letters and numbers

    I had tried this and it hadn't worked! I just tried again and still wouldn't work but then converted the data back to range then back to table and now it's working!! thank you so much, I felt I was going round in circles with this.

  4. #4
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    Glad to have helped.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  5. #5
    Registered User
    Join Date
    05-11-2022
    Location
    Scotland
    MS-Off Ver
    MS Office 365
    Posts
    8

    Re: Formula for sequential ID with letters and numbers

    Hi, I found a problem with the solution sorry! when I sort the table ID stays in the row when I need it to go with the original line. I know you can use $ to absolute but when I do that the formula no longer copies correctly when I add a new line to my table, suggestions?

  6. #6
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    Please provide a workbook showing the new issue.

    Bear in mind that we provide solutions based on the information we are given: you did not say that this needed to work in a table that might be sorted, nor did you provide sample data that might have suggested this.
    Last edited by AliGW; 05-20-2022 at 06:21 AM.

  7. #7
    Registered User
    Join Date
    05-11-2022
    Location
    Scotland
    MS-Off Ver
    MS Office 365
    Posts
    8

    Re: Formula for sequential ID with letters and numbers

    I think I have attached it now?
    Attached Files Attached Files

  8. #8
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    Right.

    You have two options: change your approach slightly or use VBA. Which would you prefer?

  9. #9
    Registered User
    Join Date
    05-11-2022
    Location
    Scotland
    MS-Off Ver
    MS Office 365
    Posts
    8

    Re: Formula for sequential ID with letters and numbers

    it is for other people who have zero excel skills so would like to avoid VBA if possible as they wouldn't know how to fix it or change in future and I may not be here

  10. #10
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    In that case you should be using a database that requires no user manipulation.

    A spreadsheet is not the way to go in your case. You would have to go with a VBA solution to make it idiot-proof (sorry, but that's what you are saying!).

    You have shared with us only a pinhole peep into the real thing, and I fear this thread could go on and on as you add in more and more requirements.

    I am going to respectfully withdraw from this thread. Sorry.

  11. #11
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,954

    Re: Formula for sequential ID with letters and numbers

    Try this in A2:

    =COUNTA($B$2:B2)

    Or:

    =ROWS($A$2:A2)

  12. #12
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    How is this going to resolve the sorting issue?

  13. #13
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,915

    Re: Formula for sequential ID with letters and numbers

    try below formula in A2 and use data validation
    Please find the attached file.
    Attached Files Attached Files
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  14. #14
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,636

    Re: Formula for sequential ID with letters and numbers

    That doesn't wolve the sorting issue either!

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    1
    ID NAME
    2
    SOP0001
    Bob Arms
    3
    SOP0002
    Bob Arms
    4
    SOP0003
    John Smith
    5
    SOP0004
    John Smith
    6
    SOP0005
    John Smith
    7
    SOP0006
    John Smith
    8
    SOP0007
    John Smith
    9
    SOP0008
    John Smith
    10
    SOP0009
    Michael Hanks
    11
    SOP0010
    Michael Hanks
    12
    SOP0011
    13
    SOP0012
    Sheet: Sheet1

  15. #15
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,915

    Re: Formula for sequential ID with letters and numbers

    Try below formula in A2, the number will not change even after sorting the data
    =ROW(Sheet1!$A2)-ROW(Table1[[#Headers],[ID]])

  16. #16
    Registered User
    Join Date
    05-11-2022
    Location
    Scotland
    MS-Off Ver
    MS Office 365
    Posts
    8

    Re: Formula for sequential ID with letters and numbers

    IT WORKED! thank you so much I use microsoft office exl app 365 if anyone uses this solution

+ 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. Sequential numbers and letters across cells
    By Caustic Base in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-24-2022, 06:23 PM
  2. Sequential numbers and letters combined
    By imcflyer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-02-2021, 12:59 PM
  3. [SOLVED] VBA code for sequential numbers for a column containing letters and numbers
    By YuriyBaron in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2018, 10:03 PM
  4. Generate sequential letters and numbers populated on textbox (userform)
    By stewart1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-25-2015, 03:40 PM
  5. Sequential letters in a formula
    By studentresearcher in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-17-2014, 10:28 AM
  6. [SOLVED] Making a Part# List, Sequential Increments with Letters and numbers in front...
    By kpl39 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-31-2012, 08:29 PM
  7. Replies: 4
    Last Post: 07-29-2012, 08:40 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