+ Reply to Thread
Results 1 to 11 of 11

next available sequential number dependant on two additional variables

  1. #1
    Registered User
    Join Date
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    Office 2016/365
    Posts
    6

    next available sequential number dependant on two additional variables

    Good day all,
    I'm looking for some assistance in how to generate the next available sequential number dependant on two additional variables.

    I am creating a document register and the two controlled variables are (the document owning) Group and Type.


    The titles of the documents are to follow the format: GGGG_TTTT_NNNNN

    Where:
    GGGG, for example, is Group-A, Group-B, Group-C, etc.
    TTTT is Type-A, Type-B, Type-C, etc.
    and NNNNN is a numerical identifier using sequential integers of the format 00000, 00001, 00002, etc.

    Group-A can have documents of Type-A, and Type-B both with the numerical identifier 00000, for example:

    Group-A_Type-A_00000
    Group-A_Type-B_00000


    How can I ensure that if Group-A produce another Type-A document that the next available numerical identifier of 00001 is used, and allow another Type-B document to be produced that would also use 00001 as its next available numerical identifier?

    MS Excel v2209 for Office 365.
    Attached Files Attached Files
    Last edited by Driver84; 10-18-2022 at 07:43 AM.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: next available sequential number dependant on two additional variables

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is you forum profile showing the version of Excel that you need this to work for?

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    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
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    Office 2016/365
    Posts
    6

    Re: next available sequential number dependant on two additional variables

    Hi Ali,
    And thank you for the welcome.

    Your advice is duly noted and I have edited my original post to include a sample workbook as advised.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: next available sequential number dependant on two additional variables

    One way:

    =TEXT(COUNTIFS(B$3:B3,B3,C$3:C3,C3)-1,"00000")
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: next available sequential number dependant on two additional variables

    or if you prefer:

    =COUNTIFS(B$3:B3,B3,C$3:C3,C3)-1

    and format as 00000

  6. #6
    Registered User
    Join Date
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    Office 2016/365
    Posts
    6

    Re: next available sequential number dependant on two additional variables

    Many thanks, Glenn, on both options. I greatly appreciate it!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: next available sequential number dependant on two additional variables

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  8. #8
    Registered User
    Join Date
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    Office 2016/365
    Posts
    6

    Re: next available sequential number dependant on two additional variables

    Apologies for reopening this thread.

    One additional condition that I did not consider in my original post (and would not have known about until I kindly received the working solution:
    - How do I amend the formula =TEXT(COUNTIFS(B$3:B3,B3,C$3:C3,C3)-1,"00000") to show the cell as 'blank' if column B and/or C hasn't been set to one of the controlled values?
    Attachment 801147
    (Apologies, I can't seem to add additional attachments)

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: next available sequential number dependant on two additional variables

    See file. Both options are present.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    Office 2016/365
    Posts
    6

    Re: next available sequential number dependant on two additional variables

    Thanks for this, Glenn, I appreciate your help so far.
    What I noted is that the formula is set up for only if Column B is 'blank':
    =IF(B3="","",
    If you delete a value from Column C the number defaults to -00001
    Attachment 801281
    I tried to amend this so that if Column B and/or Column C is 'blank', then there's no output:
    =IF(B18="","",(OR(C18="","")),TEXT(COUNTIFS(B$3:B18,B18,C$3:C18,C18)-1,"00000"))
    But when doing this I get the message "You've entered too many arguments for this function." Is there a way to overcome this?

  11. #11
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: next available sequential number dependant on two additional variables

    Try this:

    =IF(OR(B18="",C18=""),"",TEXT(COUNTIFS(B$3:B18,B18,C$3:C18,C18)-1,"00000")

+ 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] Updating workbook formulas for additional variables
    By nickpavlov in forum Excel General
    Replies: 18
    Last Post: 12-04-2021, 05:49 PM
  2. Transform multiple rows from same record to one row with additional columns for variables
    By Coloradolady65 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-15-2021, 12:27 PM
  3. LEFT with additional variables
    By king10001 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-10-2014, 07:56 AM
  4. [SOLVED] Additional variables for LOOKUP formulas
    By melbox in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-05-2014, 09:30 AM
  5. Need help getting row count dependant on 2 variables
    By s4driver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2013, 09:49 AM
  6. How to calculate a total dependant on variables
    By daveouch in forum Excel General
    Replies: 13
    Last Post: 10-01-2009, 04:08 AM
  7. [SOLVED] [SOLVED] Creating sequential variables on the fly
    By ForestRamsey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2005, 04:10 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