lookup data on excel using multiple criteria

With 2016 and earlier we need to use INDEX with some form of SMALL. I like AGGREGATE as it allows the ignoring of errors.

The basic AGGREGATE is:

AGGREGATE(15,7,ROW($B$2:$B$7)/(ISNUMBER(MATCH($B$2:$B$7,{"ALFA","DEN"},0))),ROW($ZZ1)))

As it iterates the cells in $B$2:$B$7 it returns an array of row numbers and errors. The 7 tells the formula to ignore the errors.

ROW($ZZ1) is a counter starting at 1 then moving to the next as it is dragged down. This tells the Aggregate which one in the array to return to the INDEX.

Then we wrap in INDEX:

=IFERROR(INDEX(A:A,AGGREGATE(15,7,ROW($B$2:$B$7)/(ISNUMBER(MATCH($B$2:$B$7,{"ALFA","DEN"},0))),ROW($ZZ1))),"")

Note that the references in the AGGREGATE are specific to the data set and the index is not. We want to limit the references in the AGGREGATE to limit the number of iterations.

Then we just replace the A:A in the index with C:C to get the second column. And drag both formulas down till we get blanks

enter image description here


This is made much easier in Office 365:

=FILTER(CHOOSE({1,2},A:A,C:C),ISNUMBER(MATCH(B:B,{"ALFA","DEN"},0)))

And the results will spill automatically.