[]
        
(Showing Draft Content)

SEARCH

This function finds one text string within another text string and returns the position at which the specified text starts. The search is not case-sensitive.

Syntax

SEARCH(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 character position in withinText at which to start the search. The first character is position 1.

If omitted, the search starts from the first character.

Remarks

  • The function is not case-sensitive. Use the FIND 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 length of within_text, the function returns the #VALUE! error.

Data Types

Accepts string and numeric data.

Returns numeric data.

Examples

activeSheet.setFormula(0, 0, '=SEARCH("margin","Gross Margin")');// 7
activeSheet.setFormula(1, 0, '=SEARCH("m","Gross Margin",8)'); // #VALUE!