+ Reply to Thread
Results 1 to 4 of 4

Arrays with multiple search criteria

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Bath, England
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Arrays with multiple search criteria

    Hello, I am struggling and wonder if somebody can help me.

    I have successfully created single-criteria arrays that returns a list of values. In their simplest form (i.e. removing IFERROR functions etc), the following arrays work. (I'll be honest that I don't fully understand why they work; I've just adapted examples I've found on the net).

    =INDEX(Data,SMALL(IF(Type="Gold",ROW(Name)),ROW(1:1))-5,15) - this returns a list of names for all people that selected the gold service
    =INDEX(Data,SMALL(IF(Date=$F$4,ROW(Name)),ROW(1:1))-5,15) - this returns a list of names for all people who booked on a certain date

    Where the following are defined names for cells (in a different worksheet):
    Data=all columns/rows of customer data (A:AR)
    Date=column for date of booking (K:K)
    Name=column for customer names (O:O)
    Type=column for type of service (B:B)

    What I need to do is search by both criteria (list of people who have a gold service on a certain date). My first thought was to use:

    =INDEX(Data,SMALL(IF(AND(Type="Gold",Date=$F$4),ROW(Name)),ROW(1:1))-5,15

    However, that returns a #VALUE error.

    Any thoughts on how to restructure the formula to make it work?


    For a bonus question, although this might not be possible, is there a way of returning the list in a different order to the source data, e.g. alphabetical order based on one of the columns (customer name) in the returned list?

    Many thanks in advance.

    Simon.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,995

    Re: Arrays with multiple search criteria

    Suggest you post a sample workbook.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    Bath, England
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Re: Arrays with multiple search criteria

    Thanks TMS - have created a simple one that isn't 40MB in size, and just has the templates necessary.

    Sample.xlsx

  4. #4
    Registered User
    Join Date
    07-09-2014
    Location
    Bath, England
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Re: Arrays with multiple search criteria

    I've worked it out - I need to nest the IF statements:

    =INDEX(Data,SMALL(IF(Type="Gold",IF(Date=$F$4)),ROW(Name)),ROW(1:1))-5,15

    Seems so obvious in hindsight...

    Still no idea how to return it in a different order though...

+ 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. Replies: 4
    Last Post: 05-20-2014, 10:03 AM
  2. [SOLVED] Countifs arrays with multiple criteria and subtotal function
    By 5150 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-12-2013, 01:58 AM
  3. [SOLVED] Search Table by Partial String Criteria, No Arrays
    By daffodil11 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-30-2013, 10:13 AM
  4. Search Multiple Worksheets Against List of Non-Exact Search Criteria?
    By thump4r in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-17-2010, 03:46 PM
  5. Search multiple worksheets for multiple arrays
    By member72661 in forum Excel General
    Replies: 1
    Last Post: 12-14-2010, 06:44 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