+ Reply to Thread
Results 1 to 6 of 6

Returning data from a table based one matching one or more criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    03-10-2010
    Location
    Newcastle, England
    MS-Off Ver
    Excel for Mac 2011
    Posts
    32

    Returning data from a table based one matching one or more criteria

    Can anyone help? I have a table of data which I need to extract rows from based on whether they meet one or both of two criteria.

    Each row is a record and each record can have more than one value for criteria 1 or criteria 2 - I need to look at each row and see if they have either of them in any of the columns and return the ones that do.

    I fear I haven't explained that very well, I've attached a sample workbook - the search I am trying to do is on the sheet 'Search' and the data I am looking at is in 'Trusts'. If anyone can see what I am trying to achieve and can think of a better way of doing it then please let me know!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Returning data from a table based one matching one or more criteria

    Hello
    One way would be to create a Helper column to mark the matching records. See the attached example. I hope I've understood you correctly the formulas are in the grey cells and return any names matching the Area of Interest and Project chosen.

    DBY
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-10-2010
    Location
    Newcastle, England
    MS-Off Ver
    Excel for Mac 2011
    Posts
    32

    Re: Returning data from a table based one matching one or more criteria

    Oh wow - such a quick response! Thanks so much! Do you know how to make it so that you can leave one of the criteria blank, giving a broader range of records returned? So for example if I select 'Elderly' but leave 'Project' blank, can we return all the records which match 'Elderly' only?

    Also, would you mind explaining a little bit about what you did with the formula? Always good to learn something new!

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

    Re: Returning data from a table based one matching one or more criteria

    Or try this in A12 without helper column (and copy down)
    Formula: copy to clipboard
    =IFERROR(INDEX(Trusts!$A$1:$A$26,IFERROR(1/AGGREGATE(14,6,1/(((Trusts!$B$2:$B$26=Search!$B$3)+(Trusts!$C$2:$C$26=Search!$B$3)+(Trusts!$D$2:$D$26=Search!$B$3)+(Trusts!$E$2:$E$26=Search!$B$3)>0)*((Trusts!$F$2:$F$26=Search!$B$7)+(Trusts!$G$2:$G$26=Search!$B$7)+(Trusts!$H$2:$H$26=Search!$B$7)+(Trusts!$I$2:$I$26=Search!$B$7)>0)*ROW($A$2:$A$26)),ROW(A1)),""),1),"")

  5. #5
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Returning data from a table based one matching one or more criteria

    Hi
    Glad it was of help. You can amend the formula in the helper column with an OR argument:

    Formula: copy to clipboard
    =IF(AND(OR(COUNTIF(B2:E2,Search!$B$3),Search!$B$3="(Blank)"),OR(COUNTIF(F2:I2,Search!$B$7),Search!$B$7="(Blank)")),ROWS($J$2:J2),"")


    I think this works ok but you will need to test it out.

    Also, would you mind explaining a little bit about what you did with the formula?
    Which formula in particular or both?

  6. #6
    Registered User
    Join Date
    03-10-2010
    Location
    Newcastle, England
    MS-Off Ver
    Excel for Mac 2011
    Posts
    32

    Re: Returning data from a table based one matching one or more criteria

    Thanks so much guys! I am off on holiday now for a week or so but I will check this out when I am back, thank you very much for your help!

+ 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] Returning data from one spreadsheet to another based on criteria
    By harrisdm in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-08-2016, 09:16 AM
  2. returning table data based on 3 criteria using INDEX and nested IF
    By j.mcavoy in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-11-2015, 06:51 AM
  3. [SOLVED] Index, Match, or VLoopup? Returning a table value based on criteria from two drop down's
    By jkwlvsky in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-18-2015, 06:40 PM
  4. matching data to a criteria and returning a value
    By ryza21 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2015, 11:17 PM
  5. Replies: 2
    Last Post: 06-08-2014, 09:47 PM
  6. Returning data in one table based on the values from another table
    By excelignorant in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-24-2013, 04:12 AM
  7. Replies: 5
    Last Post: 02-29-2012, 10:39 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