Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using INDEX MATCH to return multiple rows in Google Sheets

I'm currently trying to use an INDEX/MATCH formula to return values from a data sheet into a summary sheet based on user entered criteria.

This is the formula I have so far:

=INDEX(DATA!A:AF,MATCH(B1&C1&E1,DATA!AA:AA&DATA!AD:AD&DATA!AC:AC,0))

However it only returns the first row that matches the results. How can I get it to return all of the rows that match the results of the MATCH?

Thanks!

like image 255
Mark Ainsworth Avatar asked Apr 21 '15 15:04

Mark Ainsworth


2 Answers

Maybe consider the use of FILTER():

=FILTER(DATA!A:AF, B1&C1&E1=DATA!AA:AA&DATA!AD:AD&DATA!AC:AC)
like image 102
JPV Avatar answered Oct 17 '22 17:10

JPV


For anyone else perusing this topic several years later, you can also use the query formula. This is a useful article to better help learn it: https://www.benlcollins.com/spreadsheets/google-sheets-query-sql/

In this case, you can you use:

=Query(DATA!A:AF,"select * where AA = "&B1&" AND AD = "&C1&" AC = "&E1)`

The Query formula uses a version of the SQL to help you filter and return the exact data you need. I can't stress how useful it can be!

The string break and ampersands are necessary to reference a field outside of the data range notated in the first field of the Query formula.

like image 36
NMALM Avatar answered Oct 17 '22 16:10

NMALM