+ Reply to Thread
Results 1 to 6 of 6

Geting highest number value from list with values which are text/number combinations

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    159

    Geting highest number value from list with values which are text/number combinations

    Hi all,

    I need to write code to generate "Request #" based on selected "Request type" value in the UserForm. Below is a workbook example.

    Generate unique number.xlsb

    The code should be in the following format: AA_Cus_000000

    AA_ - Request type code. From the request type it takes only the first 2 letters
    Cus_ - Reference that this is customer. This value is constant for all Request #
    000000 - Numeric code for the request type.

    Currently my code counts the number of request types in column A (based on the input in the user form).
    Based on that it finds the next free consecutive number for the "Request #"

    The problem is, when a line which contains "Request #" is deleted, the calculation will not work properly. The total number of "Request type" values in column A for a chosen value will be smaller then the next consecutive number.

    In the list in the attached file are removed 3 rows. The next "Request #" for Request type AAG3 should be "AA_Cus_000015". But my calculation will give "AA_Cus_000012" (since there are already 11 values for request AAG3 in column A).

    Can anyone advice how can I get the highest number value (last 6 characters) in column B, based on the selection for the "Request type".

    Thank you in advance.

    Igor

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Geting highest number value from list with values which are text/number combinations

    Try replacing your code with this one-
    Please Login or Register  to view this content.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Geting highest number value from list with values which are text/number combinations

    Hi Sourabh,

    Thank you for your code.

    I've change
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    and it works.

    The only problem is that it will work only if there are already some values in row 7. If there are no values in row 7 does not generated code in the user form.
    Also, if there are some empty cells in column A, the code can overwrite the last already existing values. I need to find the last filled cell in row A, and insert the data below it.

    Thank you in advance for your help.

    Igor

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Geting highest number value from list with values which are text/number combinations

    Sorry for the errors.

    Change both the macros with these -
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Geting highest number value from list with values which are text/number combinations

    Hi Sourabh,
    IT WORKS PERFECTLY!!!!
    Thank you for your help!!!
    Cheers.
    Igor

  6. #6
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Geting highest number value from list with values which are text/number combinations

    Hi Sourabh,
    IT WORKS PERFECTLY!!!!
    Thank you for your help!!!
    Cheers.
    Igor

+ 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] Return 4th highest number not in list.
    By JO505 in forum Excel General
    Replies: 5
    Last Post: 08-03-2015, 04:25 PM
  2. [SOLVED] Formula to count the number of unique text values from a list.
    By PritishD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2015, 05:42 AM
  3. Replies: 5
    Last Post: 11-24-2014, 02:28 PM
  4. [SOLVED] Drop Down List with Number & Text Values
    By Phily915 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-06-2014, 09:35 PM
  5. Find Highest or Closest number from list
    By ChrisKustom in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 08-10-2013, 08:41 AM
  6. Replies: 2
    Last Post: 06-26-2012, 10:01 AM
  7. [SOLVED] geting the smaller number in a line??
    By Felipe in forum Excel General
    Replies: 2
    Last Post: 12-28-2005, 11:20 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