Skip to content
Excel functionNot in Google Sheets

TEXTBEFORE function in Google Sheets

Google Sheets doesn't have TEXTBEFORE — here's what does.

Google Sheets gets there with SPLIT + INDEX, or REGEXEXTRACT when you need the last occurrence.

What TEXTBEFORE does in Excel

Returns text that occurs before a given character or string

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

Convert TEXTBEFORE formulas to Google Sheets

Before and after, formula by formula.

  1. The username before the @:

    Excel
    =TEXTBEFORE(A2, "@")
    Google Sheets
    =INDEX(SPLIT(A2, "@"), 1)
  2. Everything before the LAST slash:

    Excel
    =TEXTBEFORE(A2, "/", -1)
    Google Sheets
    =REGEXEXTRACT(A2, "(.*)/")

    Regex is greedy, so (.*)/ captures up to the final slash.

Converting more than one formula? The Excel ↔ Sheets translator rewrites whole workbooks and flags every TEXTBEFORE so none slip through silently.

Browse Excel text functions