+ Reply to Thread
Results 1 to 6 of 6

Find next avaliable number in out of sequence column

  1. #1
    Registered User
    Join Date
    05-23-2008
    Posts
    2

    Find next avaliable number in out of sequence column

    Hi All,

    I need to be able to click on a button that will look at the contents of a column and return the next avaliable number in numerical order, even if the contents of the column are out of numerical order.

    Example:

    In column B

    RFW0009
    RFW0002
    RFW0001

    RFW0004
    RFW0008

    RFW0010
    RFW0003
    RFW0007
    RFW0005

    RFW0006

    So I need something that will look at the column above and return a result of RFW0011.

    I hope that makes sense and someone can help me out.

    Cheers

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Kudos247

    ...and welcome to the forum!!

    If your range occupies, say, B1:B10 then something like this should help :
    =LEFT("RFW0000",7-LEN(MAX(VALUE((RIGHT(B1:B10,4))))+1)) & MAX(VALUE((RIGHT(B1:B10,4))))+1
    This is an array formula, so Ctrl + Shift + Enter to commit.

    HTH

    DominicB
    Last edited by dominicb; 05-23-2008 at 04:45 AM.
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Contributor
    Join Date
    01-05-2004
    Location
    Helsinki, Finland
    Posts
    100
    Hi,

    how about this?

    Please Login or Register  to view this content.
    EDIT: Sorry, too hasty. That doesn't work.

    but this does:

    Please Login or Register  to view this content.
    It's also an array formula, so ctrl+shift+enter to commit.

    - Asser
    Last edited by Jazzer; 05-23-2008 at 05:48 AM.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Another option

    Just enter the numbers like 1 to 10 then custom format the cells as
    "RFW"0000
    Then use this formula to return the next value...again format cell as above

    =LARGE(A:A,1)+1
    Last edited by VBA Noob; 05-23-2008 at 09:04 AM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,705
    a variation.......

    =TEXT(MAX(SUBSTITUTE(0&B1:B100,"RFW","")+1), "RFW0000")

    confirmed with CTRL+SHIFT+ENTER

  6. #6
    Registered User
    Join Date
    05-23-2008
    Posts
    2
    Quote Originally Posted by VBA Noob
    Another option

    Just enter the numbers like 1 to 10 then custom format the cells as


    Then use this formula to return the next value...again format cell as above

    Thanks Guys,

    I ended up using VBA Noob's idea which was the most simplistic but worked a treat.

    Thank you all for your help. Much appreciated.

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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