Excel FIND and SEARCH functions with formula examples

The tutorial explains the syntax of the Excel FIND and SEARCH functions and provides formula examples of advanced non-trivial uses.

In the last article, we covered the basics of the Excel Find and Replace dialog. In many situations, however, you may want Excel to find and extract data from other cells automatically based on your criteria. So, let's have a closer look at what the Excel search functions have to offer.

Excel FIND function

The FIND function in Excel is used to return the position of a specific character or substring within a text string.

The syntax of the Excel Find function is as follows:

FIND(find_text, within_text, [start_num])

The first 2 arguments are required, the last one is optional.

  • Find_text - the character or substring you want to find.
  • Within_text - the text string to be searched within. Usually it's supplied as a cell reference, but you can also type the string directly in the formula.
  • Start_num - an optional argument that specifies from which character the search shall begin. If omitted, the search starts from the 1st character of the within_text string.

If the FIND function does not find the find_text character(s), a #VALUE! error is returned.

For example, the formula =FIND("d", "find") returns 4 because "d" is the 4th letter in the word "find". The formula =FIND("a", "find") returns an error because there is no "a" in "find".
Excel FIND function

Excel FIND function - things to remember!

To correctly use a FIND formula in Excel, keep in mind the following simple facts:

  1. The FIND function is case sensitive. If you are looking for a case-insensitive match, use the SEARCH function.
  2. The FIND function in Excel does not allow using wildcard characters.
  3. If the find_text argument contains several characters, the FIND function returns the position of the first character. For example, the formula FIND("ap","happy") returns 2 because "a" in the 2nd letter in the word "happy".
  4. If within_text contains several occurrences of find_text, the first occurrence is returned. For example, FIND("l", "hello") returns 3, which is the position of the first "l" character in the word "hello".
  5. If find_text is an empty string "", the Excel FIND formula returns the first character in the search string.
  6. The Excel FIND function returns the #VALUE! error if any of the following occurs:
    • Find_text does not exist in within_text.
    • Start_num contains more characters than within_text.
    • Start_num is 0 (zero) or a negative number.

Excel SEARCH function

The SEARCH function in Excel is very similar to FIND in that it also returns the location of a substring in a text string. Is syntax and arguments are akin to those of FIND:

SEARCH(find_text, within_text, [start_num])

Unlike FIND, the SEARCH function is case-insensitive and it allows using the wildcard characters, as demonstrated in the following example.

And here's a couple of basic Excel SEARCH formulas:

=SEARCH("market", "supermarket") returns 6 because the substring "market" begins at the 6th character of the word "supermarket".

=SEARCH("e", "Excel") returns 1 because "e" is the first character in the word "Excel", ignoring the case.

Like FIND, Excel's SEARCH function returns the #VALUE! error if:

  • The value of the find_text argument is not found.
  • The start_num argument is greater than the length of within_text.
  • Start_num is equal to or less than zero.

Excel SEARCH function

Further on in this tutorial, you will find a few more meaningful formula examples that demonstrate how to use SEARCH function in Excel worksheets.

Excel FIND vs. Excel SEARCH

As already mentioned, the FIND and SEARCH functions in Excel are very much alike in terms of syntax and uses. However, they do have a couple of differences.

1. Case-sensitive FIND vs. case-insensitive SEARCH

The most essential difference between the Excel SEARCH and FIND functions is that SEARCH is case-insensitive, while FIND is case-sensitive.

For example, SEARCH("e", "Excel") returns 1 because it ignores the case of "E", while FIND("e", "Excel") returns 4 because it minds the case.
Case-sensitive FIND vs. case-insensitive SEARCH

2. Search with wildcard characters

Unlike FIND, the Excel SEARCH function accepts wildcard characters in the find_text argument:

  • A question mark (?) matches one character, and
  • An asterisk (*) matches any series of characters.

To see how it works on real data, consider the following example:
Search with wildcard characters in Excel

As you see in the screenshot above, the formula SEARCH("function*2013", A2) returns the position of the first character ("f") in the substring if the text string referred to in the within_text argument contains both "function" and "2013", no matter how many other characters there are in between.

Tip. To find an actual question mark (?) or asterisk (*), type a tilde (~) before the corresponding character.

Excel FIND and SEARCH formula examples

In practice, the Excel FIND and SEARCH functions are rarely used on their own. Typically, you would utilize them in combination with other functions such as MID, LEFT or RIGHT, and the following formula examples demonstrate some real-life uses.

Example 1. Find a string preceding or following a given character

This example shows how you can find and extract all characters in a text string to the left or to the right of a specific character. To make things easier to understand, consider the following example.

Supposing you have a column of names (column A) and you want to pull the First name and Last name into separate columns.

To get the first name, you can use FIND (or SEARCH) in conjunction with the LEFT function:

=LEFT(A2, FIND(" ", A2)-1)

or

=LEFT(A2, SEARCH(" ", A2)-1)

As you probably know, the Excel LEFT function returns the specified number of left-most characters in a string. And you use the FIND function to determine the position of a space (" ") to let the LEFT function know how many characters to extract. At that, you subtract 1 from the space's position because you don't want the returned value to include the space.

To extract the last name, use the combination of the RIGHT, FIND / SEARCH and LEN functions. The LEN function is needed to get the total number of characters in the string, from which you subtract the position of the space:

=RIGHT(A2,LEN(A2)-FIND(" ",A2))

or

=RIGHT(A2,LEN(A2)-SEARCH(" ",A2))

The following screenshot demonstrates the result:
Splitting the first name and last names into separate columns.

For more complex scenarios, such as extracting a middle name or splitting names with suffixes, please see How to split cells in Excel using formulas.

Example 2. Find Nth occurrence of a given character in a text string

Supposing you have some text strings in column A, say a list of SKUs, and you want to find the position of the 2nd dash in a string. The following formula works a treat:

=FIND("-", A2, FIND("-",A2)+1)

The first two arguments are easy to interpret: locate a dash ("-") in cell A2. In the third argument (start_num), you embed another FIND function that tells Excel to start searching beginning with the character that comes right after the first occurrence of dash (FIND("-",A2)+1).

To return the position of the 3rd occurrence, you embed the above formula in the start_num argument of another FIND function and add 2 to the returned value:

=FIND("-",A2, FIND("-", A2, FIND("-",A2)+1) +2)
FIND formulas to find the position of 2nd and 3rd occurrences of a specific character in a string

Another and probably a simpler way of finding the Nth occurrence of a given character is using the Excel FIND function in combination with CHAR and SUBSTITUTE:

=FIND(CHAR(1),SUBSTITUTE(A2,"-",CHAR(1),3))

Where "-" is the character in question and "3" is the Nth occurrence you want to find.

In the above formula, the SUBSTITUTE function replaces the 3rd occurrence of dash ("-") with CHAR(1), which is the unprintable "Start of Heading" character in the ASCII system. Instead of CHAR(1) you can use any other unprintable character from 1 to 31. And then, the FIND function returns the position of that character in the text string. So, the general formula is as follows:

FIND(CHAR(1),SUBSTITUTE(cell,character,CHAR(1),Nth occurrence))

At first sight, it may seem that the above formulas have little practical value, but the next example will show how useful they are in solving real tasks.

Note. Please remember that the Excel FIND function is case-sensitive. In our example, this makes no difference, but if you are working with letters and you want a case-insensitive match, use the SEARCH function instead of FIND.

Example 3. Extract N characters following a certain character

To locate a substring of a given length within any text string, use Excel FIND or Excel SEARCH in combination with the MID function. The following example demonstrates how you can use such formulas in practice.

In our list of SKUs, supposing you want to find the first 3 characters following the first dash and pull them in another column.

If the group of characters preceding the first dash always contains the same number of items (e.g. 2 chars) this would be a trivial task. You could use the MID function to return 3 characters from a string, starting at position 4 (skipping the first 2 characters and a dash):

=MID(A2, 4, 3)

Translated into English, the formula says: "Look in cell A2, begin extracting from character 4, and return 3 characters".
The MID formula to extract 3 characters following a dash

However, in real-life worksheets, the substring you need to extract could start anywhere within the text string. In our example, you may not know how many characters precede the first dash. To cope with this challenge, use the FIND function to determine the starting point of the substring that you want to retrieve.

The FIND formula to return the position of the 1st dash is as follows:

=FIND("-",A2)

Because you want to start with the character that follows the dash, add 1 to the returned value and embed the above function in the second argument (start_num) of the MID function:

=MID(A2, FIND("-",A2)+1, 3)

In this scenario, the Excel SEARCH function works equally well:

=MID(A2, SEARCH("-",A2)+1, 3)
Use the FIND function to determine the starting point of the substring you want to extract.

It's great, but what if the group of chars following the first dash contains a different number of characters? Hmm... this might be a problem:
The group of chars following the first dash contains a different number of characters

As you see in the above screenshot, the formula works perfectly for rows 1 and 2. In rows 4 and 5, the second group contains 4 characters, but only the first 3 chars are returned. In rows 6 and 7, there are only 2 characters in the second group, and therefore our Excel Search formula returns a dash following them.

If you wanted to return all chars between the 1st and 2nd occurrences of a certain character (dash in this example), how would you proceed? Here is the answer:

=MID(A2, FIND("-",A2)+1, FIND("-", A2, FIND("-",A2)+1) - FIND("-",A2)-1)
The FIND formula to return all characters between the first and second occurrences of a specific character

For better understanding of this MID formula, let's examine its arguments one by one:

  • 1st argument (text). It's the text string containing the characters you want to extract, cell A2 in this example.
  • 2nd argument (start_position). Specifies the position of the first character you want to extract. You use the FIND function to locate the first dash in the string and add 1 to that value because you want to start with the character that follows the dash: FIND("-",A2)+1.
  • 3rd argument (num_chars). Specifies the number of characters you want to return. In our formula, this is the trickiest part. You use two FIND (or SEARCH) functions, one determines the position of the first dash: FIND("-",A2). And the other returns the position of the second dash: FIND("-", A2, FIND("-",A2)+1). Then you subtract the former from the latter, and then subtract 1 because you don't want to include either dash. As the result, you will get the number of characters between the 1st and 2nd dashes, which is exactly what we are looking for. So, you feed that value to the num_chars argument of the MID function.

In a similar fashion, you can return 3 characters after the 2nd dash:

=MID(A2, FIND("-",A2, FIND("-", A2, FIND("-",A2)+1) +2), 3)

Or, extract all the characters between the 2nd and 3rd dashes:

=MID(A2, FIND("-", A2, FIND("-",A2)+1)+1, FIND("-",A2, FIND("-", A2, FIND("-",A2)+1) +2) - FIND("-", A2, FIND("-",A2)+1)-1)
FIND formulas to extract three or all the characters between the 2nd and 3rd dashes

Example 4. Find text between parentheses

Supposing you have some long text string in column A and you want to find and extract only the text enclosed in (parentheses).

To do this, you would need the MID function to return the desired number of characters from a string, and either Excel FIND or SEARCH function to determine where to start and how many characters to extract.

=MID(A2,SEARCH("(",A2)+1, SEARCH(")",A2)-SEARCH("(",A2)-1)

The logic of this formula is similar to the ones we discussed in the previous example. And again, the most complex part is the last argument that tells the formula how many characters to return. That pretty long expression in the num_chars argument does the following:

  • First, you find the position of the closing parenthesis: SEARCH(")",A2)
  • After that you locate the position of the opening parenthesis: SEARCH("(",A2)
  • And then, you calculate the difference between the positions of the closing and opening parentheses and subtract 1 from that number, because you don't want either parenthesis in the result: SEARCH(")",A2)-SEARCH("(",A2))-1

Excel SEARCH formula to find and extract text between parentheses

Naturally, nothing prevents you from using the Excel FIND function instead of SEARCH, because case-sensitivity or case-insensitivity makes no difference in this example.

Hopefully, this tutorial has shed some light on how to use SEARCH and FIND functions in Excel. In the next tutorial, we are going to closely examine the REPLACE function, so please stay tuned. Thank you for reading!

Download practice workbook

FIND and SEARCH formula examples

440 comments

  1. Maam,

    your Tutorial is very helpful. now excel easy for me only bcz of youuuuuuu

    thank u

  2. Hi,
    Could you please teach me how to I extract words before and after Bin or Bt, such as name below
    Nor lina Bt Hussan, Ahmad B Mohdmmad Rozali

    I need a fomula that can seperate first name and last name. Since I have a long list of names full of different word length before and after Bin or Bt.
    Please help me with this. Thank you for your help

  3. Hi, how to replace the following standard descriptions

    Standard Description : OSL MDF 17mm 8x4 Chocolate 18678

    Example Description : Shade: 18678 col: Chocolate OSL 8x4 board

    Regards
    D S Shivarudra

  4. I want such a formula, If I put the a string value then it will give me the whole value of that cell.

    For example: if in Cell A2 have value "merge a fund" and I want to search by only fund, fun, fu,f. Cell A2 should be highlighted

  5. Hi, need help if this can work in excel

    C2 have a phrase stated as "Old maiden character"
    C3 have a phrase stated as "Old tatoo artist"

    what I want to happen in D2 and D3 cell is to search for the word "Old" in the cell C:C, and if it is found D cell will generate the word "Old"

    is this possible?

  6. Hi Svetlana,
    I would like to use a function to do this...

    IF A2 contain the text in A1 give me 1, if A3 contain the text in A1 give me 2, ELSE give me 0.

    suggestion? The find function seems not to work as it gives #VALUE! and stops this function:

    =IF(FIND(CELL("contenut",A1),$A$2)>=1,1,(IF(FIND(CELL("contenut",A1),$A$3)>=1,2,0)))

  7. Supose i have this sentance -- "Can verified list be used from an earlier project of another client targeting same technology?",

    and i want any alphabate count. then what will be the easy formullas?

  8. I have some 3 condition are as follows

    1342435-2
    2-5446465-0
    1131486

    i need to remove the number before and after the "-"dash using formula. these all 3 condition should be met

  9. I want to check whether an exact number exist in an array of numbers. For example, I have a list of numbers from A1.C10. I want to check whether a number 10.5 is in this list. If it is, the result can be True or False, if it isn't.

    • Hi,
      Try below
      =SUMPRODUCT(COUNTIF(10.5,A1:C10)=1

      • =IF(COUNTIF(A1:C10,"10.5")>0,"True","False")

        @Anthony, This formula will help you incase if you were looking for solution

  10. Hello Mrs. Svetlana...have a nice day

    Problem sample:

    Lets say I have data like this at A1 to A1000 with random code

    And I want to find and display 765, 459, 111, 989

    if i use filter it will display just one 765 or 459 or 111 or 989, or you can find them just using the scroll but that's the hardest way, i have to look one by one to find the data.

    I just want the easy way like if i type 765;59;111;989 the data will display at the table sheet all of them not one by one.

    have you found data like this? Please Share the formula.

    My, best regard.

    thank you.

  11. Hi Svetlana,

    I have few cells which had data like "adasd **red** asdfas"
    I need to search all the cells which contains "**red**" string in it.

    Could you please help.

    Thanks

    • Create a helper column and try below
      =ISNUMBER(SEARCH("**red**",Cell_with_text)

      • greate

  12. Hi wannt to take only MSA from the P.IQ.MSA.FI.02.003.F002. please let me have the formula

  13. Thank you for posting the article. I am trying to do a find and replace on a large scale. i have an english and italian translation. I would like to find all the italian phrases and replace with english. Rather than do them one at the time i have thousands of different translations. i have a file in excell with english in column A and Italian in column B Please help!

  14. =IF(COUNT(SEARCH("ab",W25)),"1",IF(COUNT(SEARCH("cd",W25)),"2",IF(COUNT(SEARCH("ef",W25)),"3","0")))
    from above formula result is fine, but if a cell(W25) contains both "ab" and "cd" it gives result as "1", where i required is "2". pls help how to search exact content.

    • Try =IFS(
      COUNT(SEARCH("ef",W25))>1, "3",
      COUNT(SEARCH("cd",W25))>1,"2",
      COUNT(SEARCH("ab",W25))>1, "1" )

  15. i want to know month position no in particular cell

  16. Hi,
    Thanks for posting this. It's awesome.

    How do I extract the middle text "Regional1" Company1 and material1 for the example below? The text strings are not always the same. I tried combining the find but I just couldn't get it to work.

    12345-LAC-600-Regional1-Company1-Material1-US

    Thanks

    • From you question I am not sure what you are attempting to accomplish but I will post a solution assuming that the phrase is located in B12 and you want "Regional1-Company1-Material1" located in another cell. The solution works as long as the number of dashes before and in the extracted information does not change. The number of characters before or after the dashes is irrelevant.

      =MID(B12,SEARCH("^",SUBSTITUTE(B12,"-","^",3))+1,SEARCH("^",SUBSTITUTE(B12,"-","^",6))-1-SEARCH("^",SUBSTITUTE(B12,"-","^",3)))

      The first SEARCH has a nested SUBSTITUTE that ends up locating the third dash and the +1 tells MID to begin on the next character after the third dash. The second SEARCH has a nested SUBSTITUTE that ends up locating the sixth dash in the string and the -1 locates the character before the dash and then the final SEARCH is the same as the first but is subtracted from the second SEARCH to tell MID the number of characters situated between the third and sixth dashes.

      If you were actually attempting to place "Regional1", "Company1" and "Material1" in separate cells you would simply manipulate the formula in those separate cells to find the third and fourth dash, fourth and fifth, and fifth and sixth dash. NOTE: The last number in each SUBSTITUTE would be the only thing that changes.

  17. Hi there !!!

    It would be much appreciated if anyone could help me to solve my problem:
    I have sheets more than 500 in a workbook. My sheet names are 1,2,3,4,5 till 500. In each sheets I have a formula in a cell. Example : VLOOKUP(A1,A1:AL300,1,FALSE).
    My request is that would it be possible to change A1 to A2 in sheet 2, A3 in sheet 3, A4 in sheet 4, till Sheet 500 automatically?
    It is very difficult to change manually for this 500 sheets.
    Looking forward to hearing from you soon.
    Kind regards

    Alex

    • ya it is possible

    • Yes it is possible through advance excel (macro)

  18. IF A2's value = O and B2's value = Y then take date from C2 and IF A2's value = O and B2's value = N then take date from D2 ELSE TAKE DATE "0"

    • Hi AJAY,

      you can use the following nested IF functions:

      =IF(AND(A2="o",B2="y"),C2, IF(AND(A2="o",B2="n"), D2, 0))

  19. Hi Svetlana, your solutions, excel formulas... are really really great. I am new in my field "MIS" and I just found these sites, now I am learning a lot from the links and the formulas and the new things you provide. Thank you very much. Appreciated.

    • Hi Suliman,

      Thank you for your feedback! I am really pleased to know that you have found our tutorials helpful.

      • Hi,

        I have a problem in excel for find and pest,

        The problem is "in a excel one page i have some numbers(123456), same page same number included in some words(abcd123456), so i can find out based on any formula please let me know, i am waiting.

    • AFAIC tha'ts the best answer so far!

  20. Awesome uses of #find & #search...

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)