Skip to content
getgriddy.ai/blog/how-to-use-left-right-mid-in-excel
Excel

How to Use LEFT, RIGHT, and MID in Excel

LEFT, RIGHT, and MID extract characters from text. Use them to clean IDs, split codes, pull dates, and standardize imported data.

·6 min read

Reviewed by Griddy

Updated for current Excel and Google Sheets workflows, with examples chosen to map back to real spreadsheet tasks rather than abstract formula syntax.

LEFT, RIGHT, and MID extract specific characters from text. They help when imported data arrives as combined codes, messy IDs, account strings, or labels that need cleanup before lookup or reporting.

Use these functions when the structure is predictable: the first three characters always mean region, the last four always mean year, or the middle segment always contains a project code.

The syntax

fx
=LEFT(text, [num_chars])
fx
=RIGHT(text, [num_chars])
fx
=MID(text, start_num, num_chars)
  • text - the cell containing the text
  • [num_chars] - how many characters to return
  • start_num - the character position where MID should start

If A2 contains WEST-0426-INV, then:

fx
=LEFT(A2, 4)

returns WEST.

fx
=RIGHT(A2, 3)

returns INV.

fx
=MID(A2, 6, 4)

returns 0426.

Example: split invoice codes

Suppose your invoice export uses codes like:

EAST-1042-PAID
WEST-1188-DUE

You want separate fields for region, invoice number, and status.

Step 1. Extract the region

fx
=LEFT(A2, 4)

For EAST-1042-PAID, this returns EAST.

Step 2. Extract the invoice number

fx
=MID(A2, 6, 4)

This starts at character 6 and returns 4 characters, so it returns 1042.

Step 3. Extract the status

fx
=RIGHT(A2, 4)

For EAST-1042-PAID, this returns PAID. For WEST-1188-DUE, the same formula would be wrong because DUE has only three characters.

WATCH OUT

LEFT, RIGHT, and MID work best when the text length is consistent. If each segment has a different length, use TEXTSPLIT or helper formulas instead.

When these formulas break

These functions count character positions. They do not understand words, separators, or business meaning. Excel is just counting.

That means the formula can break if:

  • one region has three letters and another has four
  • invoice numbers change from four digits to five
  • a source system adds a prefix
  • spaces appear before or after the code

When the delimiter is reliable, newer Excel users may prefer TEXTSPLIT. LEFT, RIGHT, and MID are still useful when the layout is fixed and compatibility matters.

Common issues

IssueCauseFix
Wrong characters returnedStart position is off by oneCount the characters including hyphens and spaces
Formula works for one row onlySegment lengths varyUse delimiter-based splitting instead
Hidden spaces appearSource data has leading or trailing spacesWrap the source in TRIM
Number loses leading zerosExtracted text is converted to a numberKeep the result as text

The Griddy way

Text extraction is easy for one row. A messy export with 600 rows is a different story.

"Split these invoice codes into region, invoice number, and status columns"

Griddy can inspect the pattern, choose fixed-position or delimiter-based formulas, and fill the cleaned fields across the sheet.

Skip the manual work

Describe it. Griddy does it.

Instead of writing this formula yourself, just tell Griddy what you need in plain English. Works in Excel and Google Sheets.

Use this on real templates

Clean imported IDs before they break the workflow

Text extraction is useful when expense exports, invoice codes, and receipt records arrive with multiple fields packed into one cell.

Finance