Findb
Syntax:¶
FINDB(find_text, within_text, [start_num])
- find_text: The text you want to find. This can be a single character or a string.
- within_text: The text in which you want to search for the
find_text. - start_num (optional): The byte position in
within_textat which to start the search. The default is 1, which starts at the first byte.
Description:¶
The FINDB function in Excel locates one text string within another and returns the starting position measured in
bytes rather than characters. This distinction is important when working with double-byte character set (DBCS)
languages such as Japanese, Chinese, and Korean, where a single character can occupy two bytes. In single-byte
character set (SBCS) languages such as English, FINDB behaves identically to the FIND function because each
character is one byte.
Like the FIND function, FINDB is case-sensitive — it distinguishes between uppercase and lowercase letters. It
does not support wildcard characters. If you need a case-insensitive byte-based search, use the SEARCHB function
instead.
Examples:¶
=FINDB("World", "Hello World")- Returns:
7(In an SBCS environment, "World" starts at byte 7, the same position as the character position.)
- Returns:
=FINDB("cat", "Concatenation")- Returns:
4(The lowercase "cat" begins at byte 4 in "Concatenation".)
- Returns:
=FINDB("Cat", "Concatenation")- Returns:
#VALUE!(The search is case-sensitive; "Cat" with an uppercase "C" does not appear in "Concatenation".)
- Returns:
=FINDB("B", "AABBCC", 3)- Returns:
3(Starting the search at byte position 3, the first "B" is found at byte 3.)
- Returns:
Notes:¶
- The
FINDBfunction is case-sensitive. UseSEARCHBif you need a case-insensitive byte-based search. - If
find_textis not found withinwithin_text, the function returns a#VALUE!error. You can wrapFINDBin anIFERRORfunction to handle this gracefully. - In SBCS languages (e.g., English),
FINDBreturns the same results asFINDbecause each character equals one byte. The difference only becomes apparent in DBCS languages where characters may occupy two bytes. - The
start_numargument counts bytes, not characters. When working with DBCS text, be mindful that a double-byte character occupies positions for two bytes. FINDBdoes not support wildcard characters (*,?). For wildcard-based byte-position searches, useSEARCHB.- For character-based position finding (rather than byte-based), use the
FINDfunction. - The
FINDBfunction is equivalent toFINDin Excel when the default language setting is a single-byte character set language. In DBCS language environments,FINDBcounts each double-byte character as 2 bytes.