Question: How do I find rows that contain a specific string value in an excel 2007 table?

Answer:

search-for-a-text-string-in-an-excel-table2

Excel 2007 array formula in B13:

=IFERROR(INDEX(Table1, SMALL(IF(ISNUMBER(FIND($C$9, Table1)), ROW(Table1)-MIN(ROW(Table1))+1, ""), ROW(Table1)-MIN(ROW(Table1))+1), COLUMN(Table1)-MIN(COLUMN(Table1))+1), "") + CTRL + SHIFT + ENTER.

Select cell range B13:E16. Click formula bar. Press + CTRL + SHIFT + ENTER.

Replace FIND function with SEARCH function if you don´t want the formula case sensitive.

Named ranges
Table1 (B3:E6)
What is named ranges?

Download excel example file
search-for-a-string-in-an-excel-table.xlsx
(Excel 2007 Workbook *.xlsx)

Explaining array formula in cell B13

Step 1 - Identify cells containg search string

Find function returns the starting point of one text string within another text string. ISNUMBER(FIND($C$9, Table1)) creates this array in cell B11:E14:

Column B has no cells containing string "AA".

Column C has 1 cell containing string "AA". Cell C3

Column D has 1 cell containing string "AA". Cell D4.

Column E has 1 cell containing string "AA". Cell E5.

Step 2 - Return row number

ROW(Table1)-MIN(ROW(Table1))+1, "") returns this array:

If  string "AA" is found in a cell in the table the corresponding row number is returned.

Step 3 - Sort the row numbers from smallest to largest

Small function returns the k-th smallest number.

SMALL(IF(ISNUMBER(FIND($C$9, Table1)), ROW(Table1)-MIN(ROW(Table1))+1, ""), ROW(Table1)-MIN(ROW(Table1))+1) returns this array:

Step 4 - Return a value at the intersection of a particular row and column

INDEX(Table1, SMALL(IF(ISNUMBER(FIND($C$9, Table1)), ROW(Table1)-MIN(ROW(Table1))+1, ""), ROW(Table1)-MIN(ROW(Table1))+1), COLUMN(Table1)-MIN(COLUMN(Table1))+1)

Step 5 - Remove errors

=IFERROR(INDEX(Table1, SMALL(IF(ISNUMBER(FIND($C$9, Table1)), ROW(Table1)-MIN(ROW(Table1))+1, ""), ROW(Table1)-MIN(ROW(Table1))+1), COLUMN(Table1)-MIN(COLUMN(Table1))+1), "")

Functions in this article:

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

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

ROW(reference) returns the rownumber of a reference

COLUMN(reference) Returns the column number of a reference

IFERROR(value;value_if_error) Returns value_if_error if expression is an error and the value of the expression itself otherwise

MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text

FIND(find_text;within_text;[start_num]) Returns the starting position of one text string within another text string. FIND is case-sensitive

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)

SMALL(array,k) returns the k-th smallest number in this data set.

This blog article is one out of five articles on the same subject.