Main content

Excel MID and RIGHT Text Extraction

By Szabó Gergő · Updated

MID takes a slice from the middle. RIGHT takes a slice from the end. Pair them with FIND when the position changes.

Syntax and arguments

=MID(text, start_num, num_chars)
text
The source cell.
start_num
First character to keep, 1-based, for MID.
num_chars
How many characters to return.

MID / RIGHT examples

01
Fixed middle

A2 is AB-12345-XY.

=MID(A2,4,5)

Starts at character 4 and keeps 12345.

02
Last four

A phone-like ID.

=RIGHT(A2,4)

Always the last four characters.

03
After a hyphen

Prefix length varies.

=MID(A2,FIND("-",A2)+1,10)

FIND supplies the start so the prefix can change length.

Common mistakes

  • start_num of 0

    MID starts at 1. 0 returns #VALUE!.

  • FIND when the mark is missing

    Wrap in IFERROR or IF(ISNUMBER(FIND(...))).

  • Using RIGHT for a middle token

    RIGHT cannot skip a suffix. Use MID or TEXTBEFORE.

MID / RIGHT FAQ

What about LEFT?

LEFT reads from the start. Use it for prefixes.

Does MID work on numbers?

Excel converts the number to text first. Format can affect the result.

Microsoft 365 alternative?

TEXTAFTER and TEXTBEFORE are easier when you have delimiters.