SEARCH & SEARCHB Functions

Excel 2007+

Summary

The SEARCH function finds the position of one text string within another, returning the starting character position. SEARCHB provides byte-based positioning for double-byte character sets. Both functions are case-insensitive and support wildcard searches.

Syntax

SEARCH(find_text, within_text, [start_num])
SEARCHB(find_text, within_text, [start_num])

Parameters

Parameter Type Required Description
find_text Text Yes Required text to find within another string
within_text Text Yes Required text string to search within
start_num Number No Optional character/byte position to begin search

Using the SEARCH, SEARCHB Function

SEARCH and SEARCHB are powerful text positioning functions ideal for parsing strings, extracting substrings, and dynamic text manipulation. Use SEARCH for standard Unicode characters and SEARCHB for legacy double-byte character sets like Japanese.

Common SEARCH, SEARCHB Examples

Basic Position Finding

=SEARCH("n","printer")

Returns 4 - position of 'n' in 'printer'

Word Within Word

=SEARCH("base","database")

Returns 5 - 'base' starts at position 5

Extract Word After Space

=MID("Profit Margin",SEARCH(" ","Profit Margin")+1,6)

Returns 'Margin' - extracts text after first space

Replace Found Text

=REPLACE("Profit Margin",SEARCH("margin","Profit Margin"),6,"Amount")

Returns 'Profit Amount' - replaces found text

Wildcard Matching

=SEARCH("*boss*","The boss is here.")

Returns 5 - matches with asterisks as wildcards

Frequently Asked Questions

SEARCH is case-insensitive and supports wildcards; FIND is case-sensitive without wildcards.

Use SEARCHB only for legacy double-byte character sets; SEARCH handles modern Unicode better.

Returns #VALUE! error. Wrap with IFERROR for custom handling.

Common Errors and Solutions

#VALUE! Error

Cause: find_text not found or invalid start_num

Solution: Verify text exists and start_num is valid (1 or greater)

Wrong Position

Cause: Case sensitivity confusion or start_num too high

Solution: Remember SEARCH ignores case; check string length

SEARCHB Deprecated Warning

Cause: Using SEARCHB in modern workbooks

Solution: Use SEARCH unless double-byte characters required

Notes

  • SEARCH is not case-sensitive (use FIND for case-sensitive)
  • Wildcards: ? = single char, * = any characters, ~=literal
  • Default start_num is 1
  • SEARCHB deprecated but available for compatibility
  • Excel 2007+ improved surrogate pair handling

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in:

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+