tech on the net

MS Excel: FIND Function (WS)

In Microsoft Excel, the FIND function returns the location of a substring in a string. The search is case-sensitive.

Syntax

The syntax for the FIND function is:

FIND( substring, string, [start_position] )

substring is the substring that you want to find.

string is the string to search within.

start_position is optional. It is the position in string where the search will start. The first position is 1.

Note

Applies To

Type of Function

Worksheet Function Example

Let's take a look at an example to see how you would use the FIND function in a worksheet:

Microsoft Excel

Based on the Excel spreadsheet above, the FIND function would return the following:

=FIND("Alpha", A1, 1) would return 1
=FIND("alpha", A1, 1) would return #VALUE!
=FIND("alpha", A2, 1) would return 1
=FIND("the", A3, 3) would return 11
=FIND("ph", "Alphabet", 2) would return 3

Frequently Asked Questions


Question: In Microsoft Excel, I have the value "Supermarket" in cell A1 and 100 in cell A2.

Objective: If A1 contains "Super", then I want A3=A2. Otherwise, I want A3=0. I'm unable to use the FIND function because if cell A1 does not contain "Super", the FIND function returns the #VALUE! error which does not let me sum column A.

Answer: To make sure that do not return any #VALUE! errors when using the FIND function, you need to also use the ISERROR function in your formula.

Let's take a look at an example.

Microsoft Excel

Based on the spreadsheet above, the FIND function would return the following:

=IF(ISERROR(FIND("Super",A1,1))=TRUE,0,A2) would return 100

In this case, cell A1 does contain the value "Super", so the formula returns the value found in cell A2 which is 100.

Microsoft Excel

Based on the spreadsheet above, the FIND function would return the following:

=IF(ISERROR(FIND("Super",A1,1))=TRUE,0,A2) would return 0

In this example, cell A1 does NOT contain the value "Super", so the formula returns 0.

Let's just quickly explain how this formula works. If cell A1 contains "Super", the FIND function will return the numerical position of the value of "Super". Thus, an error will not result (ie. the IsError function evaluates to FALSE) and the formula will return A2.

If cell A1 does NOT contain "Super", the FIND function will return the #VALUE! error causing the IsError function to evaluate to TRUE and return 0.