+ Reply to Thread
Results 1 to 3 of 3

How to get index match to pick the next available, it keeps picking the same person.

  1. #1
    Registered User
    Join Date
    05-03-2018
    Location
    Los Angeles
    MS-Off Ver
    2013
    Posts
    11

    How to get index match to pick the next available, it keeps picking the same person.

    A2:A37 has a list of military ranks.
    C2:C37 has a list of personnel with their respective ranks in A2:A37 beside them.

    N2:N20 has a list of required ranks needed for each position.
    O2:O20 will has the formula in each cell that should pick any personnel in C2:C37 that has required rank and with the function to skip over to the next available personnel with the right required rank in case any personnel are already in one of the cells in O2:O37. If required rank isn't available, it should pick the next person with the closest rank.

    Problem: It keeps picking the same person for two positions that have the same rank requirement.

    What I want it to do: I want it to pick personnel from C2:C37 that meets the rank requirement, but I'd like it to find another one that hasn't already been taken. If all the personnel with that required rank are taken, then I like it go down one rank requirement and substitute it in for the higher rank. If all none are available, then I'd like it to say "VACANT".

    In others, if there are two Captain and three lieutenants, and we have three Captain requirements that need to be billeted, then the two Captains names should be used for the first two and then pick one of the lower ranking lieutenants as substitute for the Captain position. A Major should be replaced by a Captain, and if a Captain is not available, then pick a Lieutenant.

    The goal is fill each billet as much as possible.

    So far, I've written this formula in O2:

    =INDEX(C2:C37,MATCH(N2,A2:A37,0))

    How can I improve this formula if I want the next cell O3 to find the next match that wasn't already taken in O2 or any other ones. Essentially, no repeats of personnel, just find the next one if the requirement is met.
    Attached Files Attached Files

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: How to get index match to pick the next available, it keeps picking the same person.

    Try this with a helper column

    In Q2 use this formula and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Use in O2 and copy down

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See the file
    Attached Files Attached Files

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: How to get index match to pick the next available, it keeps picking the same person.

    I decided on a VBA approach. I tired formulas but I needed to mark the person as already assigned after making the assignment, but I need the person to be unassigned before making the assignment. VB was the only solution that came to mind.

    The macro is tied to the button on cell R1.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ 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. Issue with Match and Index function, not picking the dates
    By Rajkumar_h in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2017, 09:55 AM
  2. Please Help: Using Index, Match, Max & Sumifs to locate top sales person
    By vms777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-16-2017, 01:39 AM
  3. Index/Match not picking up with nth instances in list
    By Ebo12 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-25-2016, 02:45 PM
  4. [SOLVED] Index and Match function did not pick the right value
    By mahershams in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2014, 08:38 AM
  5. Excel not picking libraries from where it is instructed to pick from
    By sameershr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2012, 08:31 AM
  6. Index, match, duplicates in array - how to pick up the last/bottom line
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-25-2011, 08:02 PM
  7. Replies: 1
    Last Post: 01-13-2005, 06:02 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