SEARCHB Google Sheets function

The SEARCHB function in Google Sheets is a powerful tool for locating the position of a specified string within a given text. This function is particularly useful when working with double-byte characters, as it counts each of these characters as two. Understanding how to effectively utilize SEARCHB can significantly enhance data manipulation and text processing tasks in spreadsheets.

Syntax

SEARCHB(search_for, text_to_search, [start_position])
  • search_for: The string you want to find within the text.
  • text_to_search: The text in which you are searching for the string.
  • [start_position]: (Optional) The position in the text from which to start the search. If omitted, defaults to 1, the beginning of the text.

Example #1

SEARCHB("AB", "AABBCC")
This function call looks for the string “AB” in “AABBCC”. Since “AB” starts at the first position, it would return 1.

Example #2

SEARCHB("CC", "AABBCC")
In this case, the function searches for “CC” in “AABBCC”. The letters “CC” begin at the 5th position, thus the result is 5.

Example #3

SEARCHB("AAB", "AABBCC", 2)
Here, the function looks for “AAB” starting from the second character in “AABBCC”. It finds “AAB” at position 1 (counting from the start position), so the result returns 1.

Error handling

  • VALUE!: This error occurs when the search_for parameter is an empty string.
  • N/A: This error indicates that the search_for string is not found within text_to_search.
  • NUM!: This error arises when the start_position parameter is less than 1 or greater than the length of the text_to_search.

Conclusion

In summary, the SEARCHB function is an essential tool for those needing to perform text searches, especially in cases involving double-byte characters. By correctly utilizing its parameters and handling potential errors, users can efficiently locate strings within their datasets and enhance their data processing capabilities in Google Sheets.

Leave a Reply

Your email address will not be published. Required fields are marked *