+ Reply to Thread
Results 1 to 13 of 13

Can Index or Match return multiple results?

  1. #1
    Registered User
    Join Date
    11-27-2006
    Posts
    11

    Can Index or Match return multiple results?

    I've spent the last week trying to do the following, with little to no success....and I'm running out of hair to pull out!!

    I have a worksheet (let's call it DATA) with the following column headers:
    * Site Name
    * Year Initiated
    * Status

    plus a whole bunch of other columns of information.

    On a separate worksheet (let's call it RESULTS) I'm trying to create a summary of all the Site Names where the Year Initiated = "2004" and the Status = "Active". There will be multiple occurences where this is true.

    I then want to create further results where the year = 2005, 2006, etc., etc. I've been trying to use the INDEX function with variations of MATCH, SMALL, ROW, etc., etc., but so far, no luck.

    Can anyone help? Please??

    Thanks in advance!

    Note, Advanced Filtering is not an option as I need to do further manipulating of the results on the RESULTS worksheet.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Does this example help

    VBA Noob
    Attached Files Attached Files
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    VBA, this looks great! I'm heading to a conference for the next 2 days but will look at this more closely and see if I can replicate the function with the live dataset. I haven't used ISERROR before so need some time to understand how it works.

    Thanks for taking the time and effort to put together the example and functions! Much appreciated!!

  4. #4
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    Quote Originally Posted by VBA Noob
    Hi,

    Does this example help

    VBA Noob
    Hi VBA Noob,

    I've been trying to implement your solution into my spreadsheet, but only with limited success (the overarching IF statement returns the 'value_if_true').

    Can you look at the attached and see if you can easily find the problem? I'm trying to display the results where the year and status are '2005 / 06' and 'PS'.

    Thanks!
    Attached Files Attached Files

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Try this in E2 and mod for othe condtions

    =IF(ISERROR(INDEX(AllSites!$B$1:$B$43,SMALL(IF((AllSites!$C$1:$C$43=Results!$J$2)*(AllSites!$G$1:$G$43=Results!$K$2),ROW($1:$43)),ROW(1:1)),COLUMNS($A:A))),"",(INDEX(AllSites!$B$1:$B$43,SMALL(IF((AllSites!$C$1:$C$43=Results!$J$2)*(AllSites!$G$1:$G$43=Results!$K$2),ROW($1:$43)),ROW(1:1)),COLUMNS($A:A))))

    VBA Noob

  6. #6
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    Hi VBA,

    It's working better, but not pulling the correct data out. Instead it appears to be grabbing every second site name and then starts to ignore the requirement for the site status to equal "PS". Note if I'm taking too much of your time, feel free not to respond and I'll continue trying to figure it out. I've attached the updated spreadsheet with your revisions and the results. See attached.

    I also better understand your first ROW function, but the second one and the COLUMNS function are still confusing for me.
    Attached Files Attached Files

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    =IF(ISERROR(INDEX(AllSites!$B$1:$B$43,SMALL(IF((AllSites!$C$1:$C$43=Results!$J$2)*(AllSites!$G$1:$G$43=Results!$K$2),ROW($1:$43)),ROW(1:1)),COLUMNS($A:A))),"",(INDEX(AllSites!$B$1:$B$43,SMALL(IF((AllSites!$C$1:$C$43=Results!$J$2)*(AllSites!$G$1:$G$43=Results!$K$2),ROW($1:$43)),ROW(1:1)),COLUMNS($A:A))))

    VBA Noob

  8. #8
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    It works!!! You are a genius!

    Thank-you thank-you thank-you!!

  9. #9
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    Quote Originally Posted by VBA Noob
    Try

    =IF(ISERROR(INDEX(AllSites!$B$1:$B$43,SMALL(IF((AllSites!$C$1:$C$43=Results!$J$2)*(AllSites!$G$1:$G$43=Results!$K$2),ROW($1:$43)),ROW(1:1)),COLUMNS($A:A))),"",(INDEX(AllSites!$B$1:$B$43,SMALL(IF((AllSites!$C$1:$C$43=Results!$J$2)*(AllSites!$G$1:$G$43=Results!$K$2),ROW($1:$43)),ROW(1:1)),COLUMNS($A:A))))

    VBA Noob
    Does anyone know how to revise this formula so that I can return the entire row of data (i.e., rather than just the specific cell in the first column)?

    I've tried modifying the formula so that it sets the column value in the index function to zero, but so far I must be doing something wrong...

  10. #10
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    bump bump ...

  11. #11
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    A different formula, also array entered, which brings back a different set of results.

    If you want other columns of data, then copy the formula across, but change the source column being indexed.

    Please Login or Register  to view this content.
    This is currently bringing back data from allsites!B. If you want column C, then change it to allsites!$b$1:$c$43 etc.

    rylo

  12. #12
    Registered User
    Join Date
    11-27-2006
    Posts
    11
    Thanks Rylo! Interesting approach. However, I wasn't able to get it to work in my spreadsheet. Can you attach the spreadsheet you tested it in so I can play with it a little more?

  13. #13
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Heres a file. It is based on the second sample file you put on this site. I've just put my formulas into column E.

    rylo
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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