+ Reply to Thread
Results 1 to 7 of 7

How to return all corresponding values that meet 2 criteria in excel

  1. #1
    Registered User
    Join Date
    06-27-2013
    Location
    Columbus, IN
    MS-Off Ver
    Excel 2010
    Posts
    5

    How to return all corresponding values that meet 2 criteria in excel

    Hi,

    I have a table that I would like to search to return all the values that meet 2 criteria entered by the user.

    I have 3 columns - Role Name, Skill, and Skill Level - I'd like to be able to enter the skill and skill level and return all the roles that meet the two entered criteria.

    At the moment I have an array, but it only returns the first value from the Role Name column that it finds.

    =INDEX(A2:A100,MATCH(1,IF(C2:C100=G4,IF(E2:E100=H4,1))),0)

    Where the A column is the role name, C is the Skill, and E is the Skill level. In cell G4 the user enters the skill to be search, and in H4 the level required for the skill (a scale of 1-4)

    Is it possible for the formula to return all the values in column A that meet the criteria entered in G4 and H4?

    Thanks
    Steve

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: How to return all corresponding values that meet 2 criteria in excel

    Like this?
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to return all corresponding values that meet 2 criteria in excel

    Try this array formula**.

    Let's assume you enter the formula in cell L2.

    =IFERROR(INDEX(A:A,SMALL(IF(C$2:C$100=G$4,IF(E$2:E$100=H$4,ROW(E$2:E$100))),ROWS(L$2:L2))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    06-27-2013
    Location
    Columbus, IN
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How to return all corresponding values that meet 2 criteria in excel

    Jacc - Your spreadsheet is perfect and does exactly what I want it to, until I substitute your random data with the actual data I need to use. Then is doesn't return any information.

    Tony - Your formula works, but only returns the first entry that matches the search criteria, which is the same problem I have with my formula above.

    I have attached the data I'm using.

    Thanks

    Steve

    data III.xlsx

  5. #5
    Registered User
    Join Date
    06-27-2013
    Location
    Columbus, IN
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How to return all corresponding values that meet 2 criteria in excel

    Jacc - it seems to be a problem with text rather than numbers. It doesn't seem to return a value with text. Any ideas? This has me stumped. Thanks.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to return all corresponding values that meet 2 criteria in excel

    Quote Originally Posted by sgw_73 View Post

    Tony - Your formula works, but only returns the first entry that matches the search criteria, which is the same problem I have with my formula above.

    I have attached the data I'm using.
    In your file you say you want the data from column C that meets the conditions but in your first post you say you want the data from column A.

    The formula I suggested does what you want. You just have to put the range references in the right places. Also, make sure you array enter** the formula.

    Here's the formula changed to return the data from column C as you note in the file. In this example I enter the array formula** in cell G1 then copy down:

    =IFERROR(INDEX(C:C,SMALL(IF(A$2:A$2055=E$1,IF(B$2:B$2055=F$1,ROW(B$2:B$2055))),ROWS(G$1:G1))),"")

    ** Array formulas are entered differently than a regular formula. After you type in a regular formula you hit the ENTER key. With an array formula you must use a combination of keys. Those keys are the CTRL key, the SHIFT key and the ENTER key. That is, hold down both the CTRL key and the SHIFT key then hit the ENTER key.

    When done properly Excel will enclose the formula in squiggly brackets { }. You can't just type these brackets in, you must use the key combo to produce them. Also, anytime you edit an array formula it *must* be re-entered as an array using the key combo.

    There are only 2 instances that meet the conditions:

    Account Manager
    Territory Manager

    You can test this by using this formula to count the instances:

    =COUNTIFS(A:A,E1,B:B,F1)

    Result = 2

  7. #7
    Registered User
    Join Date
    06-27-2013
    Location
    Columbus, IN
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How to return all corresponding values that meet 2 criteria in excel

    Tony - thank you! Works perfectly.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to return all corresponding values that meet 2 criteria in excel

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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] Equivalent of an index match but return all values that meet the criteria
    By Brumbot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-19-2013, 04:32 AM
  2. Replies: 6
    Last Post: 05-18-2011, 02:03 PM
  3. Meet two criteria, return 4 possible strings
    By xaos1000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-24-2011, 05:03 PM
  4. return worksheet names that do not meet criteria
    By kmfdm515 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2008, 08:44 PM
  5. Return records that meet certain criteria
    By profector in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-17-2008, 06:23 PM

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