Contact

TEXTBEFORE Function in Microsoft Excel: Syntax, Examples & Compatibility

Text Beginner Microsoft Excel

Learn how to extract the portion of a text identifier before a delimiter in Microsoft Excel. Includes syntax, two verified-by-reasoning results, troubleshooting and portability notes.

Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Microsoft Excel. How formula examples are checked

Quick answer: extract the portion of a text identifier before a delimiter in Microsoft Excel. The reproducible examples below use explicit values so the formula’s meaning is testable without a large workbook.

Evidence: The function name and syntax are documented in the linked vendor function reference. Expected outputs were independently reasoned or checked outside the application. These are not native Microsoft Excel test results. A guide being published here does not certify every software release or file-import scenario.

Syntax and arguments

=TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])

The delimiter is a text value such as "-"; the optional instance number chooses which occurrence to stop at.

Best use case: Extract the portion of a text identifier before a delimiter.

Set up the example sheet

For an item master, treat the left side of a hyphenated code as the product family. The test examples are self-contained.

Enter the formula in an unused cell. For a formula returning several values, leave an unobstructed area where those values can expand. These formulas use comma argument separators in a typical English-language locale; commas or semicolons inside quoted text are data, not argument separators. Adapt the separator if your regional settings require it.

Worked example 1: TEXTBEFORE with known input

=TEXTBEFORE("SKU-104","-")

Expected output: SKU.

Everything before the first hyphen is returned.

Worked example 2: a second TEXTBEFORE case

=TEXTBEFORE("west-east-north","-",2)

Expected output: west-east.

Stopping at the second hyphen keeps the first two segments together.

Compare both results before replacing literal values or short sample ranges with your own workbook data. For a spilling formula, compare every output cell, not only the top-left result.

Practical advice and troubleshooting

When this formula helps: Use TEXTAFTER to retrieve the suffix. Combine with IFERROR if malformed records should produce a controlled fallback.

Important edge case: If the delimiter is not present, the result can be #N/A unless an if_not_found value is provided.

If the result differs, first verify the text-versus-number types of the input cells, the argument separators for your locale, and the range size. For dynamic arrays, inspect occupied cells in the output area. An error that looks like a missing function may reflect a software version rather than incorrect data.

Compatibility and version considerations

Google Sheets supports REGEXEXTRACT and SPLIT, but its official catalogue does not list a TEXTBEFORE function of the same name.

TEXTBEFORE is a Microsoft 365/Excel 2024 text function.

Function availability and parameter behavior must be judged for the specific application and release; a function documented in one spreadsheet does not automatically work in another.

Editorial verification: Vendor catalogue referenced as of 2026-10-12. The two example outputs are independently reasoned; no native application run, screenshot, or version-specific output is claimed. Review the editorial testing standards if you require stronger proof before importing a workbook.