Lookup with multiple criteria and display multiple search results using excel formula
This blog article is one out of five articles on the same subject.
- Search for a cell value in an excel table
- Search for a text string in an excel table
- Lookup with multiple criteria and display multiple search results using excel formula
- Lookup with multiple criteria and display multiple search results using excel formula, part 2
- Lookup with multiple criteria and display multiple search results using excel formula, part 3
Read more related articles in the archive.
Question: How do I search a list containing First name column and a last name column? I want to search both columns at the same time with two different criteria (one criteria for each column) and then display multiple search results.
Answer:
I created two search fields. First and last name in E2 and G2. The search results are presented in column D and E. See picture below.
The formula in D6:D20:
= INDEX($B$2:$B$16, SMALL(IF(ISNUMBER(SEARCH($E$2, B2:B16)*(SEARCH($G$2, A2:A16))), ROW(A2:A16)-1, ""), ROW()-5)) + CTRL + SHIFT + ENTER
To remove #num errors in D6:D20, use this formula:
=IF(SUM(IF(ISNUMBER(SEARCH($E$2, B2:B16)*(SEARCH($G$2, A2:A16))), 1, 0))<ROW()-5, "", INDEX($B$2:$B$16, SMALL(IF(ISNUMBER(SEARCH($E$2, B2:B16)*(SEARCH($G$2, A2:A16))), ROW(A2:A16)-1, ""), ROW()-5))) + CTRL + SHIFT + ENTER
The formula in E6:E20:
= INDEX($A$2:$A$16, SMALL(IF(ISNUMBER(SEARCH($E$2, B2:B16)*(SEARCH($G$2, A2:A16))), ROW(A2:A16)-1, ""), ROW()-5)) + CTRL + SHIFT + ENTER
To remove #num errors in E6:E20, use this formula:
=IF(SUM(IF(ISNUMBER(SEARCH($E$2, B2:B16)*(SEARCH($G$2, A2:A16))), 1, 0))<ROW()-5, "", INDEX($A$2:$A$16, SMALL(IF(ISNUMBER(SEARCH($E$2, B2:B16)*(SEARCH($G$2, A2:A16))), ROW(A2:A16)-1, ""), ROW()-5))) + CTRL + SHIFT + ENTER
Download excel sample file for this tutorial.
multiple-criteria-lookup-with-multiple-results.xls
(Excel 97-2003 Workbook *.xls)
Functions used in this article
IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
ROW(reference) returns the rownumber of a reference
COUNT(value1;[value2])
Counts the number of cells in a range that contain numbers
SMALL(array,k) returns the k-th smallest row number in this data set.
ISNUMBER(value)
Checks whether a value is a number and returns TRUE or FALSE
SUM(number1,[number2],)
Adds all the numbers in a range of cells
SEARCH() Returns the number of the character at which a specific character or text string is first found, reading left to right (not case sensitive)
This blog article is one out of five articles on the same subject.
- Search for a cell value in an excel table
- Search for a text string in an excel table
- Lookup with multiple criteria and display multiple search results using excel formula
- Lookup with multiple criteria and display multiple search results using excel formula, part 2
- Lookup with multiple criteria and display multiple search results using excel formula, part 3
Read more related articles in the archive.
Related posts:
- Lookup with multiple criteria and display multiple search results using excel formula, part 2
- Lookup with multiple criteria and display multiple search results using excel formula, part 3
- Lookup with multiple criteria and display multiple search results using excel formula, part 4
- Search for a cell value in an excel table
- Search for a text string in an excel table
- Vlookup with 2 or more lookup criteria and return multiple matches in excel
- Search and display all cells that contain all search strings in excel
- Search and display a range of values in excel
- Lookup values in a range using two or more criteria and return multiple matches in excel




June 24th, 2009 at 3:19 am
How would I go about looking up data in an cross ref table.
I have the header row (i.e. 24) value and the column (mm) value and want to return the x/y value. i.e I have 25/X and 9/Y item and want 1.8 to be returned.
(mm) 22 23 24 25 26 27 28 29
8 1.3 1.8 1.8 1.8 1.8 1.8 2.3 2.3
9 1.3 1.8 1.8 1.8 1.8 1.8 2.3 2.3
10 1.3 1.8 1.8 1.8 1.8 1.8 2.3 2.3
11 2.2 2.8 2.8 2.8 2.8 2.8 3.3 3.3
thanks
June 24th, 2009 at 9:50 pm
See this post: http://www.get-digital-help.com/2009/06/24/looking-up-data-in-a-cross-reference-table-in-excel/
August 10th, 2009 at 2:22 am
Could this approach be expanded for more than 2 columns?
And if the values were numbers is there a way to display the values within a range between the values in 2 cells?
August 11th, 2009 at 2:58 pm
I don´t understand.
You want to search a range bigger than 2 columns?
If two numbers (or numbers between) match on any column on the same row, it is a match?
August 11th, 2009 at 3:33 pm
My comment is two seperate issues.
The first is if I can expand this equation set into more than two colums of data, say if I had a first, middle and last name column could I only display the values in which all three cases are true?
The second question is whether the equation can be adjusted to search and display a range of values, if the values were numerical, say 1 - 40 could I set a range of 20 - 25 (either in one or 2 cells) and get 6 values (inclusive)?
Apologies if it is hard to understand
August 13th, 2009 at 9:35 pm
Gavin, your first question.
See this blog post: http://www.get-digital-help.com/2009/08/13/lookup-with-multiple-criteria-and-display-multiple-search-results-using-excel-formula-part-3/
August 16th, 2009 at 11:00 pm
Gavin, your second question:
http://www.get-digital-help.com/2009/08/16/search-and-display-a-range-of-values-in-excel/
August 24th, 2009 at 9:36 pm
I have a column "A" with a last name.. I have another columb with a date in it "E"... I need to be able to list the names from columb A on a second sheet whos columb e date has past....
thanks
August 26th, 2009 at 10:52 pm
todd B, see this post: http://www.get-digital-help.com/2009/08/26/list-names-whos-date-has-past-in-excel/
August 28th, 2009 at 7:48 pm
Well, I have been looking long for this wonderful idea, and previously I had to result in two step utilizing rank command etc etc..
Thank you for the work, and thenk the NET in general!
Back to what I had in mind, I wanted specificaly do this
assume a column b from 2 to 100, where the word "check" occures, there is dropdown list resticted option, among "cash" and "other".
next to it, there is a column c from 2 to 100 also with dates, Now all I want is to incorporate in that wonderful formula of yours for simple sorting, the condition to have value "check" on col b every time I include a date for to sort..and of course to include the option to have the cells blank when there is no value...after sorting..?
Thank you for your time, it has been so much fun doing stuff in excel!!!
am I asking for too much
August 31st, 2009 at 6:32 am
also, while this formula modified for one constant filtration, either from small or family names lets say the "o" s, it does not alphabetize the results.
so what I am looking for is your classic short formula, single column, the one you have with pairs of letters...ee, wr, etc, but with a filter to screen the results too...
Is it possible to lets say pick the cell that is next to it horizontaly, and the cell next to it too, like the vlookup can do?
Ultimately I want to filtrate and indexize the dates, but also bring in the rest of the row, the name the ammount etc, associated with the date...
thank you once again
August 31st, 2009 at 7:48 am
Can you upload an excel example file?
http://www.get-digital-help.com/contact/
March 10th, 2010 at 10:23 pm
Great solution. I was wondering, though, how you seemed to "group" the cells D6:D20 and E6:E20. I downloaded the Excel example and played around and noticed that changing something in D6 automatically changed every cell from D6 to D20. That's cool!
Feel free to e-mail me if you prefer. Thanks!
March 11th, 2010 at 9:46 pm
Art,
I use search() to find rows that match. INDEX() returns a value in a given range.
The formula in D6:D20:
= INDEX($B$2:$B$16, ...
The formula in E6:E20:
= INDEX($A$2:$A$16, ...
Thanks for commenting!
/Oscar