SEARCH, SEARCHB functions
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less
This article describes the formula syntax and usage of the SEARCH and SEARCHB functions in Microsoft Excel.
Description
The SEARCH and SEARCHB functions locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. For example, to find the position of the letter «n» in the word «printer», you can use the following function:
=SEARCH(«n»,»printer»)
This function returns 4 because «n» is the fourth character in the word «printer.»
You can also search for words within other words. For example, the function
=SEARCH(«base»,»database»)
returns 5, because the word «base» begins at the fifth character of the word «database». You can use the SEARCH and SEARCHB functions to determine the location of a character or text string within another text string, and then use the MID and MIDB functions to return the text, or use the REPLACE and REPLACEB functions to change the text. These functions are demonstrated in Example 1 in this article.
Important:
-
These functions may not be available in all languages.
-
SEARCHB counts 2 bytes per character only when a DBCS language is set as the default language. Otherwise SEARCHB behaves the same as SEARCH, counting 1 byte per character.
The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.
Syntax
SEARCH(find_text,within_text,[start_num])
SEARCHB(find_text,within_text,[start_num])
The SEARCH and SEARCHB functions have the following arguments:
-
find_text Required. The text that you want to find.
-
within_text Required. The text in which you want to search for the value of the find_text argument.
-
start_num Optional. The character number in the within_text argument at which you want to start searching.
Remark
-
The SEARCH and SEARCHB functions are not case sensitive. If you want to do a case sensitive search, you can use FIND and FINDB.
-
You can use the wildcard characters — the question mark (?) and asterisk (*) — in the find_text argument. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
-
If the value of find_text is not found, the #VALUE! error value is returned.
-
If the start_num argument is omitted, it is assumed to be 1.
-
If start_num is not greater than 0 (zero) or is greater than the length of the within_text argument, the #VALUE! error value is returned.
-
Use start_num to skip a specified number of characters. Using the SEARCH function as an example, suppose you are working with the text string «AYF0093.YoungMensApparel». To find the position of the first «Y» in the descriptive part of the text string, set start_num equal to 8 so that the serial number portion of the text (in this case, «AYF0093») is not searched. The SEARCH function starts the search operation at the eighth character position, finds the character that is specified in the find_text argument at the next position, and returns the number 9. The SEARCH function always returns the number of characters from the start of the within_text argument, counting the characters you skip if the start_num argument is greater than 1.
Examples
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.
Data |
||
---|---|---|
Statements |
||
Profit Margin |
||
margin |
||
The «boss» is here. |
||
Formula |
Description |
Result |
=SEARCH(«e»,A2,6) |
Position of the first «e» in the string in cell A2, starting at the sixth position. |
7 |
=SEARCH(A4,A3) |
Position of «margin» (string for which to search is cell A4) in «Profit Margin» (cell in which to search is A3). |
8 |
=REPLACE(A3,SEARCH(A4,A3),6,»Amount») |
Replaces «Margin» with «Amount» by first searching for the position of «Margin» in cell A3, and then replacing that character and the next five characters with the string «Amount.» |
Profit Amount |
=MID(A3,SEARCH(» «,A3)+1,4) |
Returns the first four characters that follow the first space character in «Profit Margin» (cell A3). |
Marg |
=SEARCH(«»»»,A5) |
Position of the first double quotation mark («) in cell A5. |
5 |
=MID(A5,SEARCH(«»»»,A5)+1,SEARCH(«»»»,A5,SEARCH(«»»»,A5)+1)-SEARCH(«»»»,A5)-1) |
Returns only the text enclosed in the double quotation marks in cell A5. |
boss |
Need more help?
Want more options?
Explore subscription benefits, browse training courses, learn how to secure your device, and more.
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.
Содержание
- Поисковая функция в Excel
- Способ 1: простой поиск
- Способ 2: поиск по указанному интервалу ячеек
- Способ 3: Расширенный поиск
- Вопросы и ответы
В документах Microsoft Excel, которые состоят из большого количества полей, часто требуется найти определенные данные, наименование строки, и т.д. Очень неудобно, когда приходится просматривать огромное количество строк, чтобы найти нужное слово или выражение. Сэкономить время и нервы поможет встроенный поиск Microsoft Excel. Давайте разберемся, как он работает, и как им пользоваться.
Поисковая функция в Excel
Поисковая функция в программе Microsoft Excel предлагает возможность найти нужные текстовые или числовые значения через окно «Найти и заменить». Кроме того, в приложении имеется возможность расширенного поиска данных.
Способ 1: простой поиск
Простой поиск данных в программе Excel позволяет найти все ячейки, в которых содержится введенный в поисковое окно набор символов (буквы, цифры, слова, и т.д.) без учета регистра.
- Находясь во вкладке «Главная», кликаем по кнопке «Найти и выделить», которая расположена на ленте в блоке инструментов «Редактирование». В появившемся меню выбираем пункт «Найти…». Вместо этих действий можно просто набрать на клавиатуре сочетание клавиш Ctrl+F.
- После того, как вы перешли по соответствующим пунктам на ленте, или нажали комбинацию «горячих клавиш», откроется окно «Найти и заменить» во вкладке «Найти». Она нам и нужна. В поле «Найти» вводим слово, символы, или выражения, по которым собираемся производить поиск. Жмем на кнопку «Найти далее», или на кнопку «Найти всё».
- При нажатии на кнопку «Найти далее» мы перемещаемся к первой же ячейке, где содержатся введенные группы символов. Сама ячейка становится активной.
Поиск и выдача результатов производится построчно. Сначала обрабатываются все ячейки первой строки. Если данные отвечающие условию найдены не были, программа начинает искать во второй строке, и так далее, пока не отыщет удовлетворительный результат.
Поисковые символы не обязательно должны быть самостоятельными элементами. Так, если в качестве запроса будет задано выражение «прав», то в выдаче будут представлены все ячейки, которые содержат данный последовательный набор символов даже внутри слова. Например, релевантным запросу в этом случае будет считаться слово «Направо». Если вы зададите в поисковике цифру «1», то в ответ попадут ячейки, которые содержат, например, число «516».
Для того, чтобы перейти к следующему результату, опять нажмите кнопку «Найти далее».
Так можно продолжать до тех, пор, пока отображение результатов не начнется по новому кругу.
- В случае, если при запуске поисковой процедуры вы нажмете на кнопку «Найти все», все результаты выдачи будут представлены в виде списка в нижней части поискового окна. В этом списке находятся информация о содержимом ячеек с данными, удовлетворяющими запросу поиска, указан их адрес расположения, а также лист и книга, к которым они относятся. Для того, чтобы перейти к любому из результатов выдачи, достаточно просто кликнуть по нему левой кнопкой мыши. После этого курсор перейдет на ту ячейку Excel, по записи которой пользователь сделал щелчок.
Способ 2: поиск по указанному интервалу ячеек
Если у вас довольно масштабная таблица, то в таком случае не всегда удобно производить поиск по всему листу, ведь в поисковой выдаче может оказаться огромное количество результатов, которые в конкретном случае не нужны. Существует способ ограничить поисковое пространство только определенным диапазоном ячеек.
- Выделяем область ячеек, в которой хотим произвести поиск.
- Набираем на клавиатуре комбинацию клавиш Ctrl+F, после чего запуститься знакомое нам уже окно «Найти и заменить». Дальнейшие действия точно такие же, что и при предыдущем способе. Единственное отличие будет состоять в том, что поиск выполняется только в указанном интервале ячеек.
Способ 3: Расширенный поиск
Как уже говорилось выше, при обычном поиске в результаты выдачи попадают абсолютно все ячейки, содержащие последовательный набор поисковых символов в любом виде не зависимо от регистра.
К тому же, в выдачу может попасть не только содержимое конкретной ячейки, но и адрес элемента, на который она ссылается. Например, в ячейке E2 содержится формула, которая представляет собой сумму ячеек A4 и C3. Эта сумма равна 10, и именно это число отображается в ячейке E2. Но, если мы зададим в поиске цифру «4», то среди результатов выдачи будет все та же ячейка E2. Как такое могло получиться? Просто в ячейке E2 в качестве формулы содержится адрес на ячейку A4, который как раз включает в себя искомую цифру 4.
Но, как отсечь такие, и другие заведомо неприемлемые результаты выдачи поиска? Именно для этих целей существует расширенный поиск Excel.
- После открытия окна «Найти и заменить» любым вышеописанным способом, жмем на кнопку «Параметры».
- В окне появляется целый ряд дополнительных инструментов для управления поиском. По умолчанию все эти инструменты находятся в состоянии, как при обычном поиске, но при необходимости можно выполнить корректировку.
По умолчанию, функции «Учитывать регистр» и «Ячейки целиком» отключены, но, если мы поставим галочки около соответствующих пунктов, то в таком случае, при формировании результата будет учитываться введенный регистр, и точное совпадение. Если вы введете слово с маленькой буквы, то в поисковую выдачу, ячейки содержащие написание этого слова с большой буквы, как это было бы по умолчанию, уже не попадут. Кроме того, если включена функция «Ячейки целиком», то в выдачу будут добавляться только элементы, содержащие точное наименование. Например, если вы зададите поисковый запрос «Николаев», то ячейки, содержащие текст «Николаев А. Д.», в выдачу уже добавлены не будут.
По умолчанию, поиск производится только на активном листе Excel. Но, если параметр «Искать» вы переведете в позицию «В книге», то поиск будет производиться по всем листам открытого файла.
В параметре «Просматривать» можно изменить направление поиска. По умолчанию, как уже говорилось выше, поиск ведется по порядку построчно. Переставив переключатель в позицию «По столбцам», можно задать порядок формирования результатов выдачи, начиная с первого столбца.
В графе «Область поиска» определяется, среди каких конкретно элементов производится поиск. По умолчанию, это формулы, то есть те данные, которые при клике по ячейке отображаются в строке формул. Это может быть слово, число или ссылка на ячейку. При этом, программа, выполняя поиск, видит только ссылку, а не результат. Об этом эффекте велась речь выше. Для того, чтобы производить поиск именно по результатам, по тем данным, которые отображаются в ячейке, а не в строке формул, нужно переставить переключатель из позиции «Формулы» в позицию «Значения». Кроме того, существует возможность поиска по примечаниям. В этом случае, переключатель переставляем в позицию «Примечания».
Ещё более точно поиск можно задать, нажав на кнопку «Формат».
При этом открывается окно формата ячеек. Тут можно установить формат ячеек, которые будут участвовать в поиске. Можно устанавливать ограничения по числовому формату, по выравниванию, шрифту, границе, заливке и защите, по одному из этих параметров, или комбинируя их вместе.
Если вы хотите использовать формат какой-то конкретной ячейки, то в нижней части окна нажмите на кнопку «Использовать формат этой ячейки…».
После этого, появляется инструмент в виде пипетки. С помощью него можно выделить ту ячейку, формат которой вы собираетесь использовать.
После того, как формат поиска настроен, жмем на кнопку «OK».
Бывают случаи, когда нужно произвести поиск не по конкретному словосочетанию, а найти ячейки, в которых находятся поисковые слова в любом порядке, даже, если их разделяют другие слова и символы. Тогда данные слова нужно выделить с обеих сторон знаком «*». Теперь в поисковой выдаче будут отображены все ячейки, в которых находятся данные слова в любом порядке.
- Как только настройки поиска установлены, следует нажать на кнопку «Найти всё» или «Найти далее», чтобы перейти к поисковой выдаче.
Как видим, программа Excel представляет собой довольно простой, но вместе с тем очень функциональный набор инструментов поиска. Для того, чтобы произвести простейший писк, достаточно вызвать поисковое окно, ввести в него запрос, и нажать на кнопку. Но, в то же время, существует возможность настройки индивидуального поиска с большим количеством различных параметров и дополнительных настроек.
Excel SEARCH Function
- Summary. The Excel SEARCH function returns the location of one text string inside another.
- Get the location of text in a string.
- A number representing the location of find_text.
- =SEARCH (find_text, within_text, [start_num])
- find_text – The text to find. within_text – The text to search within.
Contents
- 1 How do I search for a specific text in Excel?
- 2 Why is the search function not working in Excel?
- 3 How do you search for an asterisk in Excel?
- 4 How do I search within a column in Excel?
- 5 What is the difference between find and mid?
- 6 How do you use asterisk wildcard in Excel?
- 7 How do you do a wildcard search in Excel?
- 8 How do I search for an asterisk?
- 9 How do I search a table in Excel?
- 10 What is the formula of Find function?
- 11 How does a Vlookup work?
- 12 How do you do a wildcard search?
- 13 How does * work in Excel?
- 14 What does * mean in Excel formula?
- 15 What is an Xlookup in Excel?
- 16 What is wildcard in Excel formula?
- 17 Can you use a wildcard in an Excel IF statement?
- 18 What does * mean search?
- 19 What is asterisk used for?
- 20 How do I search for a list in Excel?
How do I search for a specific text in Excel?
Find cells that contain text
On the Home tab, in the Editing group, click Find & Select, and then click Find. In the Find what box, enter the text—or numbers—that you need to find. Or, choose a recent search from the Find what drop-down box. Note: You can use wildcard characters in your search criteria.
Why is the search function not working in Excel?
To work around this issue, set the filter criteria to Show All on each worksheet in your workbook before you perform the search.Start Excel, and then open the workbook that you want to search. On the Data menu, point to Filter, and then click Show All. Repeat step 2 for each sheet in the workbook.
How do you search for an asterisk in Excel?
Use the tilde(~) before the wildcard character to search for. For example, if you want to find “*” using CTRL+F, put ~* in the “Find What” box.
How do I search within a column in Excel?
To filter with search:
- Select the Data tab, then click the Filter command. A drop-down arrow will appear in the header cell for each column.
- Click the drop-down arrow for the column you want to filter.
- The Filter menu will appear.
- When you’re done, click OK.
- The worksheet will be filtered according to your search term.
What is the difference between find and mid?
(The Find function returns the location of the dash; you want to start extracting characters beginning at the next character, the one following the dash.)Figure C: The Mid function relies on the Find function to tell it where the dash appears in the source string.
How do you use asterisk wildcard in Excel?
Type #1 – Asterisk (*)
This is to match zero or the number of characters. For example, “Fi*” could match “Final, Fitting, Fill, Finch, and Fiasco,” etc.…
How do you do a wildcard search in Excel?
For more about using wildcard characters with the Find and Replace features in Excel, see Find or replace text and numbers on a worksheet.
Using wildcard characters in searches.
Use | To find |
---|---|
* (asterisk) | Any number of characters For example, *east finds “Northeast” and “Southeast” |
How do I search for an asterisk?
Enter the root of a search term and replace the ending with the asterisk (*). For example, type comput* to find the words computer, computers, computing, computation. The asterisk can be used within words to find multiple characters.
How do I search a table in Excel?
If you go to Formulas tab of the Ribbon > Name Manager you will see Table names listed amongst other defined names. They show a different icon next to them, but to make things even clearer you can use the Filter button at the top right to show tables only.
What is the formula of Find function?
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.
How does a Vlookup work?
The VLOOKUP function performs a vertical lookup by searching for a value in the first column of a table and returning the value in the same row in the index_number position. The VLOOKUP function is a built-in function in Excel that is categorized as a Lookup/Reference Function.
How do you do a wildcard search?
To perform a single character wildcard search use the “?” symbol. To perform a multiple character wildcard search use the “*” symbol. You can also use the wildcard searches in the middle of a term.
How does * work in Excel?
If you use Excel* as the search string, it would give you any word that has Excel at the beginning followed by any number of characters (such as Excel, Excels, Excellent).
What does * mean in Excel formula?
In Excel formula, the symbol “*” means multiplication. Say cell A1 contains 5 and cell A2 contains 8.
What is an Xlookup in Excel?
Use the XLOOKUP function to find things in a table or range by row.With XLOOKUP, you can look in one column for a search term, and return a result from the same row in another column, regardless of which side the return column is on.
What is wildcard in Excel formula?
Wildcard characters in Excel are special characters that can be used to take the place of characters in a formula.The characters are used to look for a text string with the same known patterns — the beginning and the ending characters, and also, the number of characters presented in the cell.
Can you use a wildcard in an Excel IF statement?
Unlike several other frequently used functions, the IF function does not support wildcards. However, you can use the COUNTIF or COUNTIFS functions inside the logical test of IF for basic wildcard functionality.
What does * mean search?
The asterisk is a commonly used wildcard symbol that broadens a search by finding words that start with the same letters. Use it with distinctive word stems to retrieve variations of a term with less typing.
What is asterisk used for?
a small starlike symbol (*), used in writing and printing as a reference mark or to indicate omission, doubtful matter, etc.
How do I search for a list in Excel?
Run the Advanced Filter
- Select a cell in the data table.
- On the Data tab of the Ribbon, in the Sort & Filter group, click Advanced.
- For Action, select Filter the list, in-place.
- For List range, select the data table.
- For Criteria range, select C1:C2 – the criteria heading and formula cells.
- Click OK, to see the results.
Download Article
Download Article
An Excel document can be overwhelming to look through. Thankfully, you can use the search function to conveniently locate a particular word, or group of words, in an Excel worksheet.
-
1
Launch MS Excel. Do this by clicking on its icon in your desktop. It is the green X icon with spreadsheets in its background.
- If you don’t have an Excel shortcut icon on your desktop, find it in your Start menu and click the icon there.
-
2
Find the Excel file you want to open. Click “File” in the upper left corner of the window then click “Open.” A file browser will appear. Browse your computer for the Excel file you want to open.
Advertisement
-
3
Open the file. Once you’ve located the file, click on it to select then click “Open” in the lower-right portion of the file browser.
Advertisement
-
1
Click a cell. Once you’re in the worksheet, click on any cell on the worksheet to ensure that the window is active.
-
2
Open the Find/Replace With window. Hit the key combination Ctrl + F on your keyboard. A new window will appear with two fields: “Find” and “Replace with.”
-
3
Type in the words you want to find. Enter the exact word or phrase you want to search for, and click on the “Find” button in the lower right of the Find window.
- Excel will begin searching for matches of the word, or words, you entered in the search field. All words in the document that matches those you entered will be highlighted to help you better locate them.
Advertisement
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Thanks for submitting a tip for review!
About This Article
Thanks to all authors for creating a page that has been read 91,003 times.
Is this article up to date?
The SEARCH function returns the position (as a number) of one text string inside another. If there is more than one occurrence of the search string, SEARCH returns the position of the first occurrence. SEARCH is not case-sensitive but does support wildcards. Use the FIND function to perform a case-sensitive find. When SEARCH does not find anything, it returns a #VALUE! error. Note that when find_text is empty, SEARCH will return 1. This can cause a false positive when find_text is an empty cell.
Basic Example
The SEARCH function is designed to look inside a text string for a specific substring. If SEARCH finds the substring, it returns a position of the substring in the text as a number. If the substring is not found, SEARCH returns a #VALUE error. For example:
=SEARCH("p","apple") // returns 2
=SEARCH("z","apple") // returns #VALUE!
Note that text values entered directly into SEARCH must be enclosed in double-quotes («»).
TRUE or FALSE result
To force a TRUE or FALSE result, nest SEARCH inside the ISNUMBER function. ISNUMBER returns TRUE for numbers and FALSE for anything else. If SEARCH finds the substring, it returns the position as a number, and ISNUMBER returns TRUE:
=ISNUMBER(SEARCH("p","apple")) // returns TRUE
=ISNUMBER(SEARCH("z","apple")) // returns FALSE
If SEARCH doesn’t find the substring, it returns an error, and ISNUMBER returns FALSE.
Start number
The SEARCH function has an optional argument called start_num, that controls where SEARCH should begin looking for a substring. To find the first match of «the», you can omit start_num, which defaults to 1:
=SEARCH("the","The cat in the hat") // returns 1
To start searching at character 4, enter 4 for start_num:
=SEARCH("the","The cat in the hat",4) // returns 12
Wildcards
Although SEARCH is not case-sensitive, it does support wildcards (*?~). For example, the question mark (?) wildcard matches any one character. The formula below looks for a 3-character substring beginning with «x» and ending in «y»:
=ISNUMBER(SEARCH("x?z","xyz")) // TRUE
=ISNUMBER(SEARCH("x?z","xbz")) // TRUE
=ISNUMBER(SEARCH("x?z","xyy")) // FALSE
The asterisk (*) wildcard is not as useful in the SEARCH function because SEARCH already looks for a substring. For example, it might seem like the following formula will test for a value that ends with «z»:
=SEARCH("*z",text)
However, because SEARCH automatically looks for a substring, the following formulas all return 1 as a result, even though the text in the first formula is the only text that ends with «z»:
=SEARCH("*z","XYZ") // returns 1
=SEARCH("*z","XYZXY") // returns 1
=SEARCH("*z","XYZXY123") // returns 1
=SEARCH("x*z","XYZXY123") // returns 1
However, it is possible to use the asterisk (*) wildcard like this:
=SEARCH("x*2*b","AAAXYZ123ABCZZZ") // returns 4
=SEARCH("x*2*b","NXYZ12563JKLB") // returns 2
Here we are looking for «x», «2», and «b» in that order, with any number of characters in between. Finally, use the tilde (~) as an escape character to indicate that the next character is a literal like this:
=SEARCH("~*","apple*") // returns 6
=SEARCH("~?","apple?") // returns 6
=SEARCH("~~","apple~") // returns 6
The above formulas use SEARCH to find a literal asterisk (*), question mark (?) , and tilde (~) in that order.
If cell contains
To return a custom result with the SEARCH function, use the IF function like this:
=IF(ISNUMBER(SEARCH(substring,A1)), "Yes", "No")
Instead of returning TRUE or FALSE, the formula above will return «Yes» if substring is found and «No» if not.
Notes
- SEARCH returns the position of the first find_text in within_text.
- Start_num is optional and defaults to 1.
- Use the FIND function for a case-sensitive search.
- SEARCH allows the wildcard characters question mark (?) and asterisk (*), in find_text.
- ? matches any single character and
- * matches any sequence of characters.
- To find a literal ? or *, use a tilde (~) before the character, i.e. ~* and ~?.
Excel SEARCH Function (Example + Video)
When to use Excel SEARCH Function
Excel SEARCH function can be used when you want to locate a text string within another text string and find its position.
What it Returns
It returns a number that represents the starting position of the string you are finding in another string.
Syntax
=SEARCH(find_text, within_text, [start_num])
Input Arguments
- find_text – the text or string that you need to find.
- within_text – the text within which you want to find the find_text argument.
- [start_num] – a number that represents the position from which you want the search to begin. If you omit it, it starts from the beginning.
Additional Notes
- If the start number is not specified, then it starts looking from the beginning of the string.
- SEARCH function is not case-sensitive. If you want to do a case-sensitive search, use FIND function.
- SEARCH function can handle wildcard characters.
- There are three wildcard characters in Excel – the question mark (?), asterisk (*), and tilde (~).
- A question mark matches any single character.
- An asterisk matches any sequence of characters.
- If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
- There are three wildcard characters in Excel – the question mark (?), asterisk (*), and tilde (~).
- It returns a #VALUE! error if the searched string is not found in the text.
Excel SEARCH Function – Examples
Here are four examples of using Excel SEARCH function:
#1 Searching for a Word in a Text String (from the beginning)
In the above example, when you search for the word good in the text Good Morning, it returns 1, which is the position of the starting point of the searched word.
Note that Excel SEARCH function is not case sensitive. So you get the same result whether you use good, Good, or GOOD.
If you are looking for a case sensitive search, use Excel FIND function.
#2 Searching for a Word in a Text String (with a specified beginning)
The third argument in the SEARCH function is the position within the text from where you want to start the search. In the example above, the function returns 1 when you search for the text good in Good Morning and the starting position is 1.
However, it returns an error when you make it start at 2. Hence, it looks for the text good in ood Morning. Since it can not find it, it returns an error.
Note: If you skip the last argument and don’t provide the starting position, by default it takes it as 1.
#3 When there are Multiple Occurrence of the Searched Text
Excel SEARCH function starts looking in the specified text from the specified position. In the above example, when you look for the text good in Good Good Morning with the starting position as 1, it returns 1, as it finds it at the beginning.
When you start the search from the second character onwards, it returns 6, as it finds the matching text at the sixth position.
#4 Using Wildcard Characters in Excel Search Function
Excel SEARCH Function can also handle wildcard characters. In the above example, the searched text is c*l, which means any text string that beings with c and end with l and can have any number of characters in between. In Excel, it finds the searched string at the third position (Excel) and returns 3.
Excel SEARCH Function – Video Tutorial
Related Excel Functions:
- Excel FIND Function.
- Excel LOWER Function.
- Excel UPPER Function.
- Excel PROPER Function.
- Excel REPLACE Function.
- Excel SUBSTITUTE Function.
You May Also Like the Following Excel Tutorials:
- Search and Highlight Data Using Conditional Formatting.
- Create Dynamic Filter in Excel.
- Create Drop Down List with Search Suggestions.
- Separate First and Last Name in Excel
Excel SEARCH and FIND Functions: Step-by-Step Guide (2023)
The FIND function of Excel finds and returns the position of a character in a given text string.
Interestingly, the SEARCH function does the same job too. Then why do we need two different functions to do the same job 🤔
To your surprise, both these functions perform the same job but have different features.
What are those? And how can you use these functions?
To learn that (and much more about these functions), dive straight into the guide below. And do not forget to download our sample workbook here as you glide in.
How to use the FIND function
The FIND function is a straightforward function with three basic arguments. It searches for a character in a given text string and returns its relative position.
How? Check it out here 👇
Let’s find the relative position of the character ‘p’ in the word company. For that:
- Write the find_text argument of the FIND function as follows:
= FIND (“p”,
As the first argument of the FIND function, we write the character to be found ✍ Note that the character (or substring) must be enclosed in double quotation marks “”.
- Type in the text string from where the character’s position is to be found as the [within_text] argument.
= FIND (“p”, “company”)
We have typed in the word “company” enclosed in double quotation marks.
The third argument of the FIND function is the [start_num] argument.
It tells Excel to start counting from a particular character. This is an optional argument, and you may choose to omit it.
- Hit “Enter”, and you are good to go!
Excel returns the relative position of “p” from the text string “company” as 4. This is because “p” is the fourth letter of the word “company” 4️⃣
That’s how easy it is to use the FIND function in Microsoft Excel.
Now let’s see a variation to it.
- Write the FIND function to find “c” from the text string “cycle”.
= FIND (“c”, “cycle”
- Specify the start_num argument as 2.
= FIND (“c”, “cycle”, 2)
The result is 3. But we can see the character “c” comes first in the text string “cycle”. Then why does the FIND function return 3?
As we set the [start_num] argument to 2, Excel starts counting the characters from the second substring.
Start searching for the substring “c” in the word “cycle” but skip out the first two letters. The next “c” comes in the third position 🚴♀️
C Y C L E
And so, Excel returns 3.
When the [start_num] argument is omitted, Excel by default sets it to 1. And hence, the character count starts from the first character.
Pro Tip!
Excel will return a #VALUE error if you set the [start_num] argument to:
- Zero (0)
- A negative number
- Or to a number that is greater than the number of words in the [within_text] argument.
For example, you set the [start_num] argument for the function above to 6, whereas the number of characters in the word “cycle” is only 5 🚩
How to use the SEARCH function
Now comes the turn of the SEARCH function.
The Excel SEARCH function is very similar to the FIND function. However, unlike the FIND function, it is case-insensitive.
Let’s see a quick example of the SEARCH function here 👀
We are on a mission to find the position of the character “b” from the text string “My Ball”.
- Write the SEARCH function as shown below.
= SEARCH ( “b”
As the first argument, we have written the character to be found. And it must be enclosed in quotation marks.
- Next, write in the text string from where the character’s position is to be found.
= SEARCH (“b”, “My Ball”)
Close off the function right here. Or you may define the [start_num] argument if you don’t want the character count to begin from the first character.
- Hit “Enter”, and there you have your results.
The result is 4 again, and we know that’s correct ✅
By the way, this reveals that Excel counts in the space characters too. The substring “b” comes in fourth place after M, Y, and a space character.
Pro Tip!
Did you note that the SEARCH function is case insensitive?
The character “b” in our function above is in lowercase. Whereas the “b” in “My Ball” is in upper case ⚽
But that makes no difference to the SEARCH function. It was still able to find the relative position of the character “b” in “My Ball”.
SEARCH vs. FIND: The differences
We have primarily seen how to apply the FIND and SEARCH functions in Excel.
But the question still stands unanswered – why did Excel introduce two functions to perform the same job?
That’s because both these functions are quite different in the following areas:
Case Sensitivity
Let’s quickly find the position of “Money” in the text string “Time is money” using the SEARCH function.
Write the SEARCH function as follows:
= SEARCH ( “Money”, “Time is money”)
Note that the “M” for Money in our first argument is in upper case. Whereas the “m” of money in “Time is money” is a lowercase character🔍
The SEARCH function returns 9. And that’s right – M of money is the 9th character of the text string “Time is Money”.
Now let’s do the same with the FIND function.
Write the FIND function as follows:
= FIND (“Money”, “Time is money”)
That’s bizarre! The FIND function returns the #VALUE Error.
That’s because the FIND function looks for money with a capital M in the given text string. And returns the #VALUE error upon failing to find any.
This proves that the SEARCH function is case-insensitive, whereas the FIND function is case-sensitive.
Pro Tip!
Here’s something for you to observe.
What happens when you specify more than a single character as the find_text argument? Like “Money” in the example above 💸
Both the SEARCH and the FIND functions return the position of the first character of the find_text argument. (which is “M” in this case)
Wild Card Characters
Another big difference between the FIND and the SEARCH functions!
The SEARCH function accepts wild card characters. However, the FIND function doesn’t.
- Use a wildcard character with the SEARCH function as below.
= SEARCH (“Excel?????”, B2)
The word Excel is followed by five question marks (wildcard characters)❓ These question marks represent any possible five characters after the word Excel.
The within_text is specified in Cell B2, so we have created a reference to it.
- Hit “Enter”, and there you go!
Excel gives the result 7. That’s because the “E” comes at the seventh position in the text string “Great Excel 2019”.
The SEARCH function applied the wildcard characters to substitute a space character, 2, 0, 1, and 9.
It’s time we do the same using the FIND function.
- Use the same wildcard characters with the FIND function as below.
= FIND (“Excel?????”, B3)
- Hit Enter.
Excel returns a #VALUE Error. That’s because the FIND function treats each question mark as an actual question mark.
And fails to find them in the text string “Great Excel 2019” 😵
That’s it – Now what?
Woohoo! Up till now, we have seen practical examples of how the SEARCH and FIND function can be used in Excel.
We also saw the features that differentiate both these functions through practical examples. And let’s not miss out on the little tips we have been discussing throughout the guide.
Enjoyed learning about these easy yet useful functions of Excel? If yes, you’d be surprised to know that these functions don’t even make a percent of the vast function library of Excel 🗽
There are just so many more smart functions of Excel that you must learn. To mention a few, the VLOOKUP, SUMIF, and IF functions of Excel.
Here is the link to my 30-minute free email course that will teach you these (and many more) functions of Excel.
Frequently asked questions
To search for text within a cell, the ISNUMBER and the SEARCH function can be used together.
The SEARCH function will search for the given text in a specific cell. If found, it will return the text’s position in that cell.
If not found, it will return a #VALUE error. ISNUMBER returns FALSE or TRUE by checking the result to be a numeric value.
To use the FIND function to find from the right side of a text, it must be used together with the LEN function.
To find the position of “r” in the word “cars” from the right side, write your FIND function as follows:
= LEN (“cars”) + 1 – FIND (“r”, “cars”)
The above formula returns 2.
Kasper Langmann2023-01-19T12:03:26+00:00
Page load link
The SEARCH function in Excel is categorized under text or string functions, but the output returned by this function is an integer. The SEARCH function gives us the position of a substring in a given string when we provide a parameter of the position to search from. Thus, this formula takes three arguments: substring, the string itself, and position to start the search.
For example, suppose we want to search the “Thank” substring in the provided text or string “Thank you.” Here, we need to find the “Thank” word using the SEARCH function, which will return the word “Thank” location.
=SEARCH(“Thank,” B8). The output will be 1.
The SEARCH function is a text function used to find the location of a substring in a string/text.
The SEARCH function can be used as a worksheet function. It is not case-sensitive.
Table of contents
- Excel SEARCH Function
- SEARCH Formula in Excel
- Explanation
- How to Use the Search Function in excel? (with Examples)
- Example #1
- Example #2
- Example #3
- Example #4
- Things to Remember
- Search Function in Excel Video
- Recommended Articles
SEARCH Formula in Excel
Below is the SEARCH formula in Excel.
Explanation
Excel SEARCH function has three-parameter two (find_text, within_text) are compulsory parameters and one (start_num) is optional.
Compulsory Parameter:
- find_text: find_text refers to the substring/character you want to search within a string or the text you want to find out.
- within_text:. Where your substring is located or where you perform the find_text.
Optional Parameter:
- [start_num]:: from where you want to start the SEARCH within the text in excelExcel provides the functionality that helps you to search for text in the file. You can use Find and Search function to search for a specific text cell value and arrive at the result.read more. If omitted, SEARCH considers it as 1 and star search from the first character.
How to Use the Search Function in excel? (with Examples)
The SEARCH function is very simple and easy to use. Let us understand the working of the SEARCH function in some examples.
You can download this Search Function Excel Template here – Search Function Excel Template
Example #1
Let us search the “Good” substring in the given text or string. Here, we have found the “Good” word using the SEARCH function, which will return the word “Good” location in the “Good morning.”
=SEARCH(“Good,” B6) and output will be 1.
Suppose two matches are found for “Good,” then SEARCH in Excel will give you the first match value. However, if you want the other good location, then you use the =SEARCH(“Good,” B7, 2) [start_num] as 2 then it will give you the place of the second match value, and the output will be 6.
Example #2
In this example, we will filter out the first and last names from the full names using the SEARCH in excelSearch function gives the position of a substring in a given string when we give a parameter of the position to search from. As a result, this formula requires three arguments. The first is the substring, the second is the string itself, and the last is the position to start the search.read more.
For first name=LEFT(B12,SEARCH(” “,B12)-1)
For last name=RIGHT(B12,LEN(B12)-SEARCH(” “,B12))
Example #3
Suppose there is a set of IDs. First, you have to find the _ location within IDs, then use Excel SEARCH to find the “_” location within IDs.
=SEARCH(“_,” B27), and output will be 6.
Example #4
Let us understand the working of SEARCH in excel with wildcards charactersIn Excel, wildcards are the three special characters asterisk, question mark, and tilde. Asterisk denotes multiple characters, a question mark denotes a single character, and a tilde denotes the identification of a wild card character.read more.
Consider the table and search for the next 0 within the text A1-001-ID.
And start position will be 1, then =SEARCH(“?” &I8, J8, K8) output will be 3 because “?” neglects the one character before the 0, and output will be 3.
For the second row within a given table, the search result for A within B1-001-AY.
It will be 8, but if we use “*” in search, it will give you the 1 as location output because it will neglect all characters before “A,” and output will be 1 for it =SEARCH(“*” &I9, J9).
Similarly, for “J” 8 =SEARCH(I10,J10,K10) and 7 for =SEARCH(“?”&I10,J10,K10).
Similarly, for fourth row, the output will be 8 for =SEARCH(I11,J11,K11) and 1 for =SEARCH(“*” &I11,J11,K11)
Things to Remember
- It is not case-sensitive.
- It considers tanuj and TANUJ as the same value, which means it does not distinguish between lower and upper case.
- It is also allowed wildcard characters, i.e., “?”, “*,” and “~” tilde.
- “?” is used to find a single character.
- “*” is used for match sequences.
- If we want to search the “*” or”? “, we need to insert the “~” before the character.
- It returns the #VALUE! Error if there is no matching string is found in the within_text.
Suppose in the below example. We are searching for a substring “a” within the “Name” column. If found, it will return the location of a within name else. In addition, it will give a #VALUE error#VALUE! Error in Excel represents that the reference cell the user has either entered an incorrect formula or used a wrong data type (mostly numerical data). Sometimes, it is difficult to identify the kind of mistake behind this error.read more, as shown below.
Search Function in Excel Video
Recommended Articles
This article is a guide to the SEARCH Function in Excel. Here, we discuss the SEARCH formula and how to use the SEARCH function, along with Excel examples and downloadable Excel templates. You may also look at these useful functions in Excel: –
- Search Box in ExcelA search box in Excel finds the needed data by typing into it, then filters the data and displays only that much info. When working with large datasheets, this simple tool may save a lot of time.read more
- Excel Substring FunctionThe substring function in Excel is a built-in integrated function that is categorized under the TEXT function and is used to extract a string from a combination of string.read more
- Filters in Excel
- True Function in Excel
Excel SEARCH Function (Table of contents)
- SEARCH in Excel
- How to Use the SEARCH Function in Excel?
SEARCH Function in Excel
The search function works in the same principle as the Find function, where it returns the location or position of the text string in the other cell. If we see the syntax of the Search function, we will see it will return the position of text starting with anything within the selected text range. So we just need to select the text we want to find and the text within range and starting position (If required).
SEARCH Formula in Excel
The Formula for the SEARCH function is as follows:
Find_text: It is the text you want to find or Character or text for which you are searching for
Or
It is a substring which you want to look for or search within a string or full text
Note: In some cases, wildcard characters (? *), i.e. question mark & asterisk, will be present in the cells; in that scenario, use tilde (~) before this ~? & ~* to search for? & *
- Within_text: Specify a character or substring position at which or where you want to begin searching
- Start_num (Optional): from which position or where you want to start the search within the text
Note: If this (START_NUM) parameter is omitted, Then the search function considers it as 1 by default.
How to Use the SEARCH Function in Excel?
SEARCH Function in Excel is very simple and easy. Let’s understand the working of the SEARCH Function in Excel with some examples.
You can download this SEARCH Function Excel Template here – SEARCH Function Excel Template
Example #1
To Search a specific position of a word in a text string
In the below-mentioned Example, the formula =SEARCH(A5, B5,1) or =SEARCH(“n”, B5,1) returns the value 4 because n is the 4th character to the right starting from the left or the first character of a text string (Orange)
Example #2
To Search a specific position of a substring in a text string.
In the below-mentioned Example, the formula =SEARCH(A10, B10,1) or =SEARCH(“market”, B10,1) returns the value 5 because the substring “market” begins at the 5th character of a word (fish market)
Example #3
SEARCH Function – Find wildcard character ((*) ASTERISK) position within the cell
When we do search function Initially without using (~) tilde before (*) asterisk i.e. =SEARCH(“*”,B15,1). SEARCH FUNCTION returns 1 as output because we cannot find any wildcard character position without using a tilde. Here tilde (~) acts as a marker to indicate that the next character is literal; therefore, we will insert (~) tilde before (*) asterisk.
When we do search function using (~) tilde before (*) asterisk, i.e. =SEARCH(“~*”,B16,1), it returns the correct position of (*) asterisk i.e. 13 as output
Example #4
Search Function – Find wildcard character {(?) QUESTION MARK} position within cell
Here let’s try to look for a question mark position in a cell
When we do search function using (~) tilde before (?) Question mark, i.e. =SEARCH(“~?”,B21,1) it returns the correct position of (?) Question mark, i.e. 14 as output
Example #5
How to split first name & last name using a search function. When the table array contains only the first name and last name in one column separated by a single space character or comma, Then the SEARCH function is used.
A formula to separate the first name
= LEFT (cell_ref, SEARCH (” “, cell_ref) – 1)
Initially, FIND or SEARCH function is used to get the position of the space character (” “) in a cell; later, -1 is used in the formula to remove the extra space or comma at the end of the text string.
The formula to separate the last name
=RIGHT (cell_ref,LEN(cell_ref)-SEARCH(” “, Cell_Ref,1))
‘LEN’ function returns the length of a text string; in the ‘LEN’ function Spaces, are considered as characters within a string
Initially, Search the text in the cell for space, find the position and then subtract the position from the total length of the string by using the LEN formula; length of the string minus the position of the space will give us everything to the right of the first space
Note: Here, the ‘RIGHT’ & ‘LEFT’ functions return a substring of text based on the number of characters we specify from the left or right
Things to Remember
a) Start_NumArgument in the search function cannot be negative or zero
Start_Num Argument or Parameter in the search function should not be mentioned as “0” Or Negative Value; if mentioned zero or negative value, it returns the Value error
b.) SEARCH function is not CASE SENSITIVE; it will accept wildcard characters (? *), whereas find function is CASE SENSITIVE, the output will return the value as VALUE ERROR & it will not accept wildcard characters (? *).
A search function is not case-sensitive, whereas the find function is case sensitive.
Even When the given search text is not found within the text string, the return value will be #VALUE! Error
Recommended Articles
This has been a guide to the SEARCH in Excel. Here we discuss the SEARCH Formula, using the Search Function in Excel and practical examples, and a downloadable excel template. You can also go through our other suggested articles –
- Excel Shortcut Redo
- Excel SEARCH Function
- Excel Search Box
- Find and Replace in Excel