You are learning Functions and Formulas in MS Excel
How can I find the character position with the SEARCH function?
The SEARCH function in Excel tells you the starting position of a specific text string (or character) within another text string. It doesn't directly tell you the character position within the entire cell itself, but it provides the location relative to the beginning of the searched text string.
Here's how you can use SEARCH to find the character position:
Syntax:
`=SEARCH(find_text, within_text, [start_num])`
- find_text: The character or text string you want to find.
- within_text: The text string you want to search within.
- start_num (optional): The character position within `within_text` where you want to start searching. Defaults to 1 (beginning).
Example:
Let's say you have a cell (A1) containing the text "applepie" and you want to find the position of the letter "p".
- Formula: `=SEARCH("p", A1)`
- Explanation: We're searching for the character "p" (find_text) within the text string "applepie" (within_text).
- Result: The function will return the number 4.
This means the character "p" is found at the fourth position (starting from 1) within the text string "applepie".
Important Note:
- The SEARCH function is case-sensitive. So, "P" would not be found in "applepie".
- If the search text isn't found, SEARCH returns the #VALUE! error.