Learn Excel
EN
Sets how numbers, dates and formulas look, so everything works just like your own Excel.

Home › Excel functions › LEFT, RIGHT & MID

LEFT, RIGHT and MID in Excel: Extract Text with Examples

LEFT, RIGHT and MID extract part of a text: a number of characters from the start, from the end, or from somewhere in the middle. Combined with FIND, they can split names, codes and addresses into separate columns.

In this guide
  1. Syntax
  2. Basic example
  3. Try it yourself
  4. Split first and last names
  5. TEXTBEFORE / TEXTAFTER
  6. Getting real numbers
  7. Common errors
  8. More LEFT examples
  9. Keep learning
  10. FAQ

Syntax

FunctionSyntaxReturns
LEFT=LEFT(text, [num_chars])Characters from the start. Without num_chars: 1 character.
RIGHT=RIGHT(text, [num_chars])Characters from the end. Without num_chars: 1 character.
MID=MID(text, start_num, num_chars)num_chars characters, starting at position start_num.

Basic example: split a product code

ABCD
1CodeCategoryNumberCountry
2P-104-NLP104NL
3K-220-DEK220DE
  • =LEFT(A2, 1) returns P: the first character.
  • =MID(A2, 3, 3) returns 104: three characters starting at position 3.
  • =RIGHT(A2, 2) returns NL: the last two characters.

This works well when every code has the same structure. When the parts have different lengths, you need FIND.

LEFT, RIGHT & MID practice: try it yourself

Reading is one thing, typing it is another. Build the formula below step by step: the tips tell you what to type next, and you can click or drag across cells to add them, just like in Excel.

Task: Take the country code (the first two characters) from the order code, in B2: =LEFT(A2,2)

Split first and last names with FIND

FIND returns the position of a character. In "Anna Jansen", the space is at position 5.

  • First name: =LEFT(A2, FIND(" ", A2) - 1) takes everything before the space: Anna.
  • Last name: =MID(A2, FIND(" ", A2) + 1, 100) takes everything after the space: Jansen. The 100 just means "the rest"; MID stops at the end of the text.

The same pattern works for anything with a separator, such as the part of an email address before the @: =LEFT(A2, FIND("@", A2) - 1).

Easier in new Excel: TEXTBEFORE and TEXTAFTER

In Microsoft 365 and Excel 2024 you can skip the FIND arithmetic:

  • =TEXTBEFORE(A2, " ") returns Anna
  • =TEXTAFTER(A2, " ") returns Jansen
  • =TEXTSPLIT(A2, "-") splits "P-104-NL" into three cells at once

Without formulas, Data › Text to Columns or Flash Fill (Ctrl+E) can also split a column in one go.

Extracted numbers are text

LEFT, RIGHT and MID always return text. The "104" from the example looks like a number but won't add up in a SUM, and won't match the number 104 in a lookup. Convert it with VALUE or a double minus:

=VALUE(MID(A2, 3, 3))

or =--MID(A2, 3, 3).

Common errors

  • #VALUE! with FIND: the character you're looking for isn't in the text, for example a name without a space. Wrap it in IFERROR: =IFERROR(LEFT(A2, FIND(" ", A2) - 1), A2).
  • An extra space in the result: the source has double spaces. Clean it first with TRIM.
  • Results don't add up: they're text. Use VALUE.

More LEFT examples

Copy a formula and change the ranges to match your own data.

What you wantFormula
First word (for example the first name)=LEFT(A2, FIND(" ", A2)-1)
Everything after the first space=MID(A2, FIND(" ", A2)+1, 100)
Domain of an email address=RIGHT(A2, LEN(A2)-FIND("@", A2))
Remove the last 3 characters=LEFT(A2, LEN(A2)-3)
First 4 characters as a real number=VALUE(LEFT(A2, 4))

Frequently asked questions

How do I get the last word of a cell?

In Microsoft 365 or Excel 2024, use =TEXTAFTER(A2, " ", -1). The -1 means "after the last space".

How do I remove the first few characters?

Use RIGHT with the length minus the characters to remove: =RIGHT(A2, LEN(A2) - 3) removes the first 3 characters.

What's the difference between FIND and SEARCH?

Both return the position of text. FIND is case-sensitive and doesn't allow wildcards; SEARCH is not case-sensitive and does allow wildcards.

Can LEFT return a number?

No, it always returns text. Wrap it in VALUE to turn the result into a number.