How to Use TEXTBEFORE Formula in Excel + Tips

Learn how to use TEXTBEFORE function in Excel step-by-step to get text before specific delimiter, very easy and useful.

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

Hello everyone! Today i will show you how to use TEXTBEFORE formula in Excel step by step. TEXTBEFORE is available in Excel 2021 and Excel 365.

What is TEXTBEFORE Function in Excel?

The TEXTBEFORE function help you extract all text that appears before a specific character or delimiter (like space " ", dash -, at sign @, or comma ,). In old Excel, you need combine LEFT and FIND formulas together, but TEXTBEFORE make your formula very short and simple!

📚 Related Tutorial: Want to split text into multiple columns or rows instead? Check out How to Use TEXTSPLIT Function in Excel!


🛠️ Formula Syntax

=TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
  • text: The cell or original text string you want to extract from (example: A1).
  • delimiter: The symbol or text character you look for (example: "@", " ", "-").
  • [instance_num] (Optional): Which occurrence of delimiter to match (example: 1 for 1st dash, 2 for 2nd dash).
  • [match_mode] (Optional): 0 for case-sensitive match (default), 1 for case-insensitive match.
  • [if_not_found] (Optional): What text to show if delimiter is not found in cell.

Advertisement

📊 Simple Examples

Example 1: Extract First Name from Full Name

=TEXTBEFORE(A1, " ")

If cell A1 contains "John Smith", formula returns: John


Example 2: Extract Username from Email Address

=TEXTBEFORE(A1, "@")

If cell A1 contains "meng@gmail.com", formula returns: meng


Example 3: Extract Text Before Dash -

=TEXTBEFORE(A1, "-")

If cell A1 contains "John-Smith", formula returns: John


Example 4: Get Text Before 2nd Delimiter

=TEXTBEFORE(A1, "-", 2)

If cell A1 contains "2026-09-14", setting instance_num to 2 returns: 2026-09


Example 5: Avoid #N/A Error if Delimiter Missing

If delimiter might not exist in cell, use IFNA to return original cell A1 cleanly:

=IFNA(TEXTBEFORE(A1, "-"), A1)

⚡ Modern Excel Text Functions Comparison

FunctionPurposeExample
TEXTBEFOREGet text before a specific delimiter=TEXTBEFORE(A1, "@")
TEXTAFTERGet text after a specific delimiter=TEXTAFTER(A1, "@")
TEXTSPLITSplit text into columns or rows by delimiter=TEXTSPLIT(A1, ",")
TEXTJOINCombine text from multiple cells with delimiter=TEXTJOIN(", ", TRUE, A1:A5)

💡 Quick Tips & Easy Memory Rule:

  1. Memory Rule: TEXTBEFORE = Get everything BEFORE the delimiter.
  2. Case Sensitivity: TEXTBEFORE is case-sensitive by default! Searching "a" will not match "A". Set match_mode to 1 if you want case-insensitive search.

📚 Related Resources & Tutorials

Found this tutorial helpful? Share it with colleagues:
📚

Related Tutorials

Opens in new tab ↗
Advertisement