- Advanced Excel Functions Tutorial
- Advanced Excel Functions - Home
- Compatibility Functions
- Advanced Excel Functions - Cube
- Database Functions
- Date & Time Functions
- Engineering Functions
- Financial Functions
- Information Functions
- Advanced Excel Functions - Logical
- Lookup & Reference Functions
- Math & Trignometric Functions
- Statistical Functions
- Useful Resources
- Quick Guide
- Useful Resources
- Discussion
Statistical - SEARCH Function
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.
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])
Arguments
Argument | Description | Required/ Optional |
---|---|---|
find_text | The text that you want to find. | Required |
within_text | The text in which you want to search for the value of the find_text argument. | Required |
start_num | The character number in the within_text argument at which you want to start searching. | Optional |
Notes
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 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 start_num argument is omitted, it is assumed to be 1.
If the value of find_text is not found, the #VALUE! error value is returned.
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.
Applicability
Excel 2007, Excel 2010, Excel 2013, Excel 2016