Skip to content
ArumSoft Learning
KO

    Text

    TEXTBEFORE function playground

    Returns the text that comes before a delimiter, such as the user name before the @ in an email.

    Available in: Excel 2024, Microsoft 365, Excel for the webRead the full tutorial →

    The playground runs in your browser. Nothing you type is sent anywhere.

    How TEXTBEFORE works

    TEXTBEFORE finds the delimiter and returns everything to its left. With instance_num you choose which occurrence: 2 means the second one, and a negative number counts from the end.

    If the delimiter isn't there you get #N/A, unless you give if_not_found a value to show instead.

    It replaces the old LEFT and FIND combination, which needed a calculation to work out the length.

    Syntax

    =TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
    ArgumentWhat it means
    textrequiredThe text to search.
    delimiterrequiredThe text that marks the cut, such as "@".
    instance_numoptionalWhich occurrence to use. 1 by default; negative numbers count from the end.
    match_modeoptional0 case-sensitive (default), 1 ignore case.
    match_endoptional1 treats the end of the text as a delimiter. 0 by default.
    if_not_foundoptionalWhat to return when the delimiter isn't found. Without it you get #N/A.

    Examples

    FormulaWhat it doesResult
    =TEXTBEFORE(B2,"@")The user name part of the email.grace.kim
    =TEXTBEFORE(A2,",")The last name before the comma.Kim
    =TEXTBEFORE(C2,"-",2)Everything before the second dash: country and year.US-2026
    =TEXTBEFORE(C2,"-",-1)Everything before the last dash.US-2026-0412
    =TEXTBEFORE(A2,"/",,,,"No slash")A friendly result when the delimiter is missing.No slash

    Common mistakes

    #N/AThe delimiter isn't in the text, or instance_num is larger than the number of delimiters. Add an if_not_found value.
    CaseMatching is case-sensitive by default. Use 1 for match_mode to ignore case.
    VersionTEXTBEFORE needs Microsoft 365, Excel 2024 or Excel for the web. In older versions use LEFT with FIND.

    Learn more

    Download the example workbook (.xlsx)

    The workbook has the same sample data and formulas, plus a practice sheet.

    Read the full tutorial →