SEARCH

Description

Locates the position of the first character of a specified text string within another text string.

Syntax

SEARCH ( search_text, "text"[, start_position] )

Parameter Description
search_text

The text to find. Wildcard characters are:

  • * — Match any sequence of characters
  • ? — Match any single character


To search for an asterisk or question mark, include a tilde (~) before the character.The search string can contain wildcard characters.

text The text to be searched.
start_position The character position where the search begins.

If the number you specify is less than 0 or greater than the number of characters in text, #VALUE! is returned.

Omitting this argument assumes a starting position of 1.

Remarks

Text is searched from left to right, starting at the position specified. The search is not case-sensitive. If text does not contain the search string, #VALUE! is returned.

Examples

This function returns 6:

SEARCH("?5", "Bin b45")

This function returns 5:

SEARCH("b", "Bin b45", 4)

See also

FIND

MID

REPLACE

SUBSTITUTE