Documentation/Calc Functions/FINDB/en

Function name:
FINDB

Category:
Text

Summary:
Uses a case-sensitive match to find the start byte of one text string within another text string. Each string may contain both single-byte and double-byte characters.

Syntax:
FINDB(Find Text ; Text [; Position])

Returns:
Returns a positive integer which is the position of the first byte of the first occurrence of the string to be found, within the string to be searched. The value returned cannot be greater than the length (in bytes) of the string to be searched.

Arguments:
Find Text is a text string (in quotation marks), a number, or a reference to a cell containing one of those types, that is the string to be found.

Text is a text string (in quotation marks), a number, or a reference to a cell containing one of those types, that is the string to be searched.

Position is a positive integer, or a reference to a cell containing a positive integer, that is the byte position from which the search starts. If Position is omitted, FINDB uses the value 1.


 * If Position is a non-integer value, FINDB truncates it to an integer value.
 * After truncation, if Position is less than 1 or greater than, then FINDB reports an invalid argument error (Err:502).
 * If no match is found, then FINDB reports a #VALUE! error. This is an error condition, which must be handled if used as an argument to another function.

Details specific to FINDB function
FINDB does not support wildcards or regular expressions.

Use the SEARCHB function if you need searches that are not case sensitive.

In (or LibreOffice > Preferences > LibreOffice Calc > Calculate on macOS), the setting for Search criteria = and <> must apply to whole cells has no effect on the behavior of FINDB.

Suggestions for handling the #VALUE! error that is returned when no match is found include:
 * returns "ERR: Missing Substring" and does not propagate the error from the FINDB function.
 * returns "ERR: Missing Substring" and does not propagate the error from the FINDB function.

Examples:
The following examples are similar to those used for the FIND function and demonstrate the consistent behavior of the two functions for single-byte character strings.

The remaining examples demonstrate the behavior of FINDB for strings that involve double-byte characters. For ease of understanding, these examples avoid using text in languages such as Chinese, Japanese, and Korean, that utilize double-byte characters. Instead, as this is an English language page, these examples reference double-byte characters in the Halfwidth and Fullwidth Forms Unicode block that make sense in English. The Unicode character U+3000, known as the Ideographic Space, is also used in the first two of these examples.

Related LibreOffice functions:
FIND

LEFTB

LENB

MIDB

REPLACEB

RIGHTB

SEARCHB

ODF standard:
Section 6.7.2, part 2

Equivalent Excel functions:
FINDB