SEARCHB Function

Excel Functions › Text

All Excel versions DBCS languages

The Excel SEARCHB function locates one text string inside another — ignoring case and accepting wildcards — and returns the position of the match’s first byte. It is the byte-counting twin of SEARCH, built for double-byte character set (DBCS) languages — Japanese, Chinese, and Korean — where each native character occupies 2 bytes when such a language is the system default. Working in English or any other single-byte language? SEARCHB behaves exactly like SEARCH — just use SEARCH.


Quick answer: to get the byte position of "tower" in A2, any capitalization:
=SEARCHB("tower", A2) // finds "Tower" too - returns a byte position
Pair the result with MIDB or REPLACEB; for an exact-case search use FINDB.

Syntax

=SEARCHB(find_text, within_text, [start_num])
ArgumentDescription
find_textRequiredThe text to look for. Not case-sensitive. Wildcards allowed: ? = any one character, * = any run of characters; escape a literal with ~.
within_textRequiredThe string to search inside.
start_numOptionalThe byte position to start searching from. Default is 1.

Available in: all Excel versions. Byte counting activates only when a DBCS language (Japanese, Chinese Simplified/Traditional, or Korean) is the system default language; otherwise positions are character positions and SEARCHB returns exactly what SEARCH would.

SEARCHB vs SEARCH: byte positions, forgiving matches

On a Japanese-locale system, "Tower" in 東京Tower starts at character 3 but byte 5 — and SEARCHB happily matches the lowercase query:

ABC
1Text in A2: 東京TowerFormulaResult (Japanese locale)
2byte positions: 東=1–2, 京=3–4, T=5=SEARCHB("tower", A2)5
3=SEARCH("tower", A2)3
4=SEARCHB("t?w", A2)5 — wildcards work
=SEARCHB("tower", A2) // case-insensitive, byte position 5
=FINDB("tower", A2) // returns #VALUE! - FINDB insists on exact case

Wildcards make SEARCHB the flexible one of the byte pair — locate a pattern, then slice with MIDB:

=MIDB(A2, SEARCHB("t*r", A2), 9) // extract 9 bytes starting at the pattern match

Searching for a literal question mark or asterisk? Escape it with a tilde: ~? or ~*.

Try it: char vs byte position finder

Live demo

Type a string and a search term (case doesn’t matter), then toggle the system locale to see character and byte positions drift apart.

Errors & common pitfalls

Pitfall: byte positions into character functions. A SEARCHB result belongs to MIDB, LEFTB, RIGHTB, or REPLACEB. Feed it to MID or REPLACE and the cut lands mid-word on DBCS text. Match B with B.

Pitfall: results depend on the system language. The same SEARCHB formula returns different numbers on a Tokyo machine and a Dallas machine — byte counting follows the system locale, not the workbook. Document the assumption in shared files.

Working in English? Use SEARCH. On single-byte locales SEARCHB is SEARCH with a longer name. Keep formulas portable.

#VALUE! — no match found. Unlike FINDB, capitalization is never the culprit — check for typos, or remember that ? and * are wildcards here: search for ~? to find a real question mark. Wrap with IFERROR for clean output.

Practice workbook

📊
Download the free SEARCHB practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between SEARCHB and SEARCH?
SEARCH returns the match position counted in characters; SEARCHB counts in bytes. They differ only when a DBCS language (Japanese, Chinese, Korean) is the system default — each East Asian character before the match adds an extra 1 to the SEARCHB result. Matching behaviour (case-insensitive, wildcards) is identical.
What's the difference between SEARCHB and FINDB?
Same split as SEARCH vs FIND: SEARCHB ignores case and supports ? and * wildcards; FINDB matches exact case and treats every character literally. Both return byte positions.
Why does SEARCHB give me the same answer as SEARCH?
Your system default language isn’t a DBCS language, so every character counts as one byte and the positions coincide. That’s expected — and the sign to simply use SEARCH.
How do wildcards work in SEARCHB?
? matches any single character and * matches any run of characters (including none) — =SEARCHB("t?wer", A2) finds “tower” or “tAwer”. To search for a literal ? or *, prefix it with a tilde: ~?, ~*, and ~~ for a real tilde.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: SEARCH · FINDB · MIDB · REPLACEB · LENB