- What does TEXTBEFORE return when the delimiter is not in the text?
- It returns #N/A. Supply the sixth argument, if_not_found, to get something else instead — an empty string is the usual choice, written as =TEXTBEFORE(A2, "-", 1, 0, 0, ""). Wrapping the whole call in IFNA works too, but the built-in argument is clearer and does not hide other errors.
- Can TEXTBEFORE handle multi-character delimiters?
- Yes. The delimiter argument can be any string, such as "--" or "|". TEXTBEFORE will look for the exact sequence of characters you specify.
- What is the difference between instance_num and match_end?
- instance_num chooses which occurrence of the delimiter to cut at, while match_end (0 or 1) decides whether the search starts from the beginning (0) or the end (1) of the text.
- Why does TEXTBEFORE sometimes return a numeric value instead of text?
- If the text argument is a number, Excel coerces it to text before processing, so the result is still a text string. However, if you concatenate a number with text, the number is first converted to its string representation.