Skip to main content

Text formula page

Extract First Word Formula

Use this when names, labels, or imported text need the first token separated.

Best for

Extract the first word from text.

What it returns

If A2 is Maya Chen, the result is Maya.

Copy formulas

Excel formula
=TEXTBEFORE(TRIM(A2)&" ", " ")
Google Sheets formula
=REGEXEXTRACT(TRIM(A2), "^\S+")
Excel / Google Sheets difference

Excel uses TEXTBEFORE with an appended space so a single word still works. Google Sheets uses REGEXEXTRACT to return the first non-space run.

Example data

Raw TextExample Result
Maya ChenMaya
SKU-1001-EastSKU
https://www.example.com/pricingexample.com
Acme North Acme North
What it returns

If A2 is Maya Chen, the result is Maya.

How the formula works

  • TRIM removes extra spaces before extraction.
  • The formula returns text before the first space.
  • The Google Sheets version captures the first non-space run.
Syntax pieceRole in the formula
TRIM(A2)The source text with leading, trailing, and repeated regular spaces normalized.
TRIM(A2)&" "The Excel source with an appended space so a one-word value has a delimiter.
" "The Excel delimiter marking the first word boundary.
^\S+The Google Sheets regex for the first non-space run.

Verified examples

First name from full name
=TEXTBEFORE(TRIM(A2)&" ", " ")

Excel: Enter Maya Chen in A2. Returns: Maya

Leading and repeated spaces
=REGEXEXTRACT(TRIM(A2), "^\S+")

Google Sheets: Enter two leading spaces, Acme, three spaces, North, and two trailing spaces in A2. Returns: Acme

Single token
=TEXTBEFORE(TRIM(A2)&" ", " ")

Excel: Enter SKU-1001-East in A2. Returns: SKU-1001-East

Common errors and fixes

IssueLikely causeFix
The first word is not separatedThe input contains nonbreaking spaces rather than regular spaces.Replace CHAR(160) or the imported nonbreaking space before applying TRIM.
Punctuation remains in the resultThe formulas split on whitespace but do not remove punctuation.Add a separate cleanup step if punctuation should be stripped.
TEXTBEFORE is unavailableThe Excel version predates the TEXTBEFORE function.Use a legacy LEFT and FIND pattern or the split-text alternative.

When not to use this formula

  • Do not use this pattern when the first token must be punctuation-normalized or parsed as a separate semantic field.

Alternatives

AlternativeWhen to use it
Split Text FormulaUse when every whitespace-delimited part should be returned or split across cells.
Extract Last Word FormulaUse when the final token, rather than the first, is needed.

Related formulas

Official references

FAQ

Why does the Excel formula append a space?

The appended space gives TEXTBEFORE a delimiter even when A2 contains only one word.

Does this remove punctuation?

No. Punctuation remains part of the token because the formulas only identify whitespace boundaries.