[]
        
(Showing Draft Content)

SEARCHB

This function searches one text value within another and returns the text value’s position in the text you searched.

Syntax

SEARCHB(find_text, within_text, [start_num])

Arguments

This function has the following arguments:

Argument

Description

find_text

The text that you want to find.

within_text

The text in which you want to search for find_text.

start_num

[Optional] The byte position in within_text at which to start the search. The first byte is position 1.

If omitted, the search starts from the first byte.

Remarks

  • SEARCHB counts each double-byte character as 2 bytes when a language that supports a double-byte character set (DBCS) is used. Otherwise, SEARCHB behaves in the same way as SEARCH.

  • The function is not case-sensitive. Use the FINDB function to perform a case-sensitive search.

  • You can use the question mark (?) and asterisk (*) wildcard characters in find_text. A question mark matches any single character, and an asterisk matches any sequence of characters.

  • To search for an actual question mark or asterisk, type a tilde (~) before the character.

  • If find_text is not found, the function returns the #VALUE! error.

  • If start_num is less than or equal to 0 or greater than the byte length of within_text, the function returns the #VALUE! error.

Examples

activeSheet.setFormula(0, 0, '=SEARCHB("MOB","MOBILE")');// 1
activeSheet.setFormula(0, 0, '=SEARCHB("B","MOBILE")');// 3
activeSheet.setFormula(1, 0, '=SEARCHB("B","MOBILE",4)');// #VALUE!