AnalystPracticeGuides
DashboardSign up

LEFT, RIGHT, MID and LEN: extracting text in Excel

LEFT takes characters from the start of a text, RIGHT from the end, and MID from the middle. LEN counts the characters. Together with FIND they split codes, names and IDs.

How do the four functions work?

For the order code "AT-2026-0457" in A2:

FormulaResult
=LEFT(A2,2)AT
=RIGHT(A2,4)0457
=MID(A2,4,4)2026
=LEN(A2)12

MID takes the text, the start position and the number of characters.

How do you split at a separator when lengths vary?

Find the separator first. First name from "Ana Petrović":

=LEFT(A2,FIND(" ",A2)-1)

Last name:

=MID(A2,FIND(" ",A2)+1,LEN(A2))

Asking MID for more characters than exist is fine, it simply returns the rest.

Why do my extracted numbers not add up?

LEFT, RIGHT and MID always return text. "0457" is text, so SUM ignores it. Wrap it in VALUE to get a number: =VALUE(RIGHT(A2,4)).

Is there an easier way in new Excel?

In Microsoft 365, TEXTBEFORE and TEXTAFTER split at a separator without counting characters, and TEXTSPLIT splits into several cells at once.

Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise LEN, LEFT, RIGHT Practise MID Practise all three

Updated November 2026.

← All free guides