+ Reply to Thread
Results 1 to 22 of 22

Show Next Available Number

  1. #1
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Show Next Available Number

    Hello, I am trying to determine how I can display my next available folio number on a spreadsheet. The numbers start at 2018-001 and go indefinitely until the year is over and then start at 2019-001 and go indefinitely until the end of the year. I found the formula below on another thread and it has the basic idea but it is trying to start at 1. I am also unsure how to adjust it because my folio numbers have "-" in them. Does anyone know if what I am trying to do is possible?

    =IFERROR(INDEX(ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A))),MATCH(0,INDEX(COUNTIF(A:A,ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A)))),),0)),MAX(A:A)+1)

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,758

    Re: Show Next Available Number

    If your numbers are all in column A this will give you the next available number for the current year. I am going from your first and second sentences. I have no idea what that formula you show is supposed to be doing.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Thank you! Any idea why it's showing me my next available number is 2018-308 even though I've used that number already? I've confirmed there are no typos in the spreadsheet or formula. If I add another 2018-308 to the spreadsheet it will show the next available is 2018-309, again though, this number also already has been used.

  4. #4
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    I've narrowed down the issue. It's because the very last number entered in column A is 2018-307. Is there a way to adjust the formula to show the next available number in the whole column? The numbers are not in numerical order because I keep them organized by date.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    Because those cells contain text, not a real number, excel cannot easily determine what the highest have would be. Would you consider adding a helper column to pull out the "number"? This would simplify everything.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Show Next Available Number

    Could you post a sample file, it would make it much easier to provide help.

    To make sure I understand:

    There are 2 parts to this folio number: year-sequence #.

    We want the sequence number to increment +1 to always be 1 more than the greatest previous in the same folio number combination of year-sequence? IE: 2017-001, 2018-001...2017-002, 2018-002, right?

    Is the sequence number always 3 digits or x number of digits or can we use real numbers? IE: 001, 002, ... 099 ... 999 vs 1, 2, ... 99 ... 999

    Can we get the year automatically from another cell in the same row or do we need to manually determine the year to use (either using current year or a static year)?
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  7. #7
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Sure, I have attached a sample.

    You are correct that there are two parts to the folio, the year and then a number. It is always a 3 digit number (001, 002, 003). I want to determine what the next available number to use would be by going up in increments of 1. There is not currently a place to pull the year from but I can easily add that. Additionally, some folios are entered more than once and the numbers are not in numerical order.
    Attached Files Attached Files

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    Would you consider using a helper column?

    I used this in col E...
    =--SUBSTITUTE(A3,"-","")
    copied down.

    Then to get the next number...
    =LEFT(MAX(E3:E26),4)&"-"&TEXT(RIGHT(MAX(E3:E26),3)+1,"000")

  9. #9
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Show Next Available Number

    Quote Originally Posted by kwac01 View Post
    Additionally, some folios are entered more than once
    Could you clarify what you mean here? I was under the impression you wanted to generate folio numbers, if the folio numbers are generated what dictates if they are repeated or unique?

    To be sure, you are not trying to both manually enter new folio numbers AND generate them automatically too, right?

  10. #10
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Yes, I can enter a helper column. I have also attached a better sample sheet that looks much more like what I am using. I would probably use Column O for my helper column. The formula would go in E2
    Attached Files Attached Files
    Last edited by kwac01; 07-31-2018 at 03:28 PM.

  11. #11
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Currently, I have to manually determine what my next folio number should be and type it in in the next available row. I have been coming across an issue where I think I have the next available number but I ended up using one that was used before. So I'm trying to put a formula in a cell which will tell me what my actual next available to use would be.


    They are sometimes entered more than once because if there is any new information attached to that file, I enter a new row with the new info. This is for money coming in an out on a file. For example, for file number 2017-001 I received $500, that is entered into a row. 4 weeks later, I give someone $300 from that file, that is entered on a new row with the same folio number of 2017-001. BUt I may have already enters a bunch of other folios in between those rows. When I have a brand new file, I am trying to determine what my next available folio to use would be.
    Last edited by kwac01; 07-31-2018 at 03:34 PM.

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    Chane the formula in O to this...
    =IF(A4="","",--SUBSTITUTE(A4,"-",""))
    copied down

    You can hide this column if you want to

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    Actually, here is a much shorter way, without using the helper.

    E2=SUMPRODUCT(MAX(--SUBSTITUTE($A$4:$A$34,"-","")))+1
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  14. #14
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Love it! But it doesn't update as I start entering new folios in new rows without having to go in an adjust the formula range every time. If I change the range to a much higher number, say 1000, without actaully having had entered any info in those rows, I get the #VALUES! error. See new attached spreadsheet with new rows added and E2=SUMPRODUCT(MAX(--SUBSTITUTE($A$4:$A$34,"-","")))+1. Notice it says my next available folio is 2018016 but it should actually be 2018018.
    Attached Files Attached Files

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    It doesnt like the empty cells

    Try this instead, it creates a dynamic range (still CSE)
    =SUMPRODUCT(MAX(--SUBSTITUTE(OFFSET($A$1,3,0,COUNTA($A:$A)-2,1),"-","")))+1

  16. #16
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    SCORE! That's a win, thank you!

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    Good stuff. Happy to help and thanks for the feedback

    (Dont forget to remove that helper column if you dont need it)

  18. #18
    Registered User
    Join Date
    09-02-2013
    Location
    wellington, new zealand
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Show Next Available Number

    I see you have solved this already, however, I have an alternative solution which might as well have.

    It is a macro on the sheet rather than in the module and it fires every cell selection but only does stuff to empty cells in column 1.

    It gives you the option to specify the year

    Even if you don't like it you may be able to use the technique for something else.
    Attached Files Attached Files

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Show Next Available Number

    k1w1sm hanks for sharing your suggestion

    Just because a thread is resolved, doesnt mean there are not any other/better suggestions out there

  20. #20
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Hello everyone! This formula has been helpful for almost 8 months now. Today, I opened my spreadsheet, copied the formula to give to a coworker for her spreadsheet and now the formula does not work for her or me. I now get the #VALUE! error message. I noticed that if I open the old example spreadsheet I used in this post, double click in the formula box and press enter, without changing anything, the formulas all revert to the #VALUE! error message. Has something changed in excel that it no longer likes these formulas? Here is exactly what I currently have in my formula box, any ideas? =SUMPRODUCT(MAX(--SUBSTITUTE(OFFSET($A$1,3,0,COUNTA($A:$A)-2,1),"-","")))+1

  21. #21
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,758

    Re: Show Next Available Number

    Sounds like you are not entering it as an array formula. Recall the direction given by FDibbins earlier:

    Quote Originally Posted by FDibbins View Post
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  22. #22
    Registered User
    Join Date
    07-30-2018
    Location
    Atlanta
    MS-Off Ver
    2016
    Posts
    12

    Re: Show Next Available Number

    Oh wow, derp. -__- Thank you!

+ 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: 7
    Last Post: 07-25-2018, 06:09 AM
  2. [SOLVED] If number is missing in a sequence, highlight and show number
    By pkool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2017, 01:22 AM
  3. Can I have a message box show a specified number of times and then not show again?
    By gmr4evr1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2016, 07:50 PM
  4. [SOLVED] automatically show the equivalent number in column B depending on the number in columnA
    By Elainefish in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-31-2013, 04:19 AM
  5. Find highest number of sales in a date range and show seller and sale number
    By audiofreak in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2012, 03:34 AM
  6. [SOLVED] Macro to show how many times one number appears with another number
    By Omega71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2012, 10:53 AM
  7. Replies: 4
    Last Post: 01-02-2007, 07:50 AM

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.6.0 RC 1