SEARCHB

Formulas / SEARCHB
Find where a substring is within another string.
SEARCHB(find_text,within_text,[start_num])
  • find_text - The text you want to find. This is the substring you are searching for within the "within_text" argument.
  • within_text - The text in which you want to search for the "find_text" argument. This is the larger text string that you are searching within.
  • [start_num] - [OPTIONAL] The position in the "within_text" argument from which you want to start the search. If omitted, the search starts at the beginning of the "within_text" argument. The first character in "within_text" is position 1.

Examples

  • =SEARCHB("world", "Hello world!")

    In this example, the SEARCHB function is used to find the starting position of the substring "world" within the larger text string "Hello world!" The formula returns the value 7, indicating that the substring "world" starts at the 7th character position in the larger text string. Note that the SEARCHB function is used with double-byte character set (DBCS) languages and counts each double-byte character as two characters.

  • =SEARCHB("apple", "I have an apple.", 10)

    In this example, the SEARCHB function is used to find the starting position of the substring "apple" within the larger text string "I have an apple." The search starts at the 10th character position, as specified by the optional [start_num] argument. The formula returns the value 11, indicating that the substring "apple" starts at the 11th character position in the larger text string. Again, note that the SEARCHB function is used with double-byte character set (DBCS) languages and counts each double-byte character as two characters.

Summary

The SEARCHB function is used to find the position of the first text string within another text string, starting at the specified position. It is the same as the SEARCH function, but it allows for a more specific search.

  • The SEARCHB function is the same as SEARCH and returns the number of the starting position of the first text string from the first character of the text string that is searched.
  • The SEARCH and SEARCHB functions are not case sensitive.
  • When a DBCS language is used as the default language, SEARCHB counts 2 bytes per character.


Frequently Asked Questions

What is the SEARCHB function?
The SEARCHB function is the same as the SEARCH function, which returns the number of the starting position of the first text string in the second text string.
How does the SEARCHB function work?
The SEARCHB function counts 2 bytes for each character only when the DBCS language is set as the default language.
What are some examples of how to use the SEARCHB function?
  • To locate the position of a particular word in a text string.
  • To find the location of a string of text in a larger string of text.
  • To return the numeric position of a character in a string.
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV