ElyxAI
formulas

How to Use LEFT, RIGHT, MID

Excel 2016Excel 2019Excel 365Excel Online

Learn to extract text from specific positions within cells using LEFT, RIGHT, and MID functions. These formulas let you isolate portions of strings—LEFT grabs from the start, RIGHT from the end, MID from any position—essential for data cleaning, parsing codes, and reformatting information without manual editing.

Why This Matters

These functions are critical for data parsing, splitting codes or IDs, and cleaning messy datasets without manual work. They're fundamental to any data analyst or administrator's toolkit.

Prerequisites

  • Basic understanding of cell references and formulas
  • Familiarity with text data in Excel

Step-by-Step Instructions

1

Open Excel and prepare sample data

Create a new worksheet with sample text in column A (e.g., 'Apple-2024-USA'). This data will be used to demonstrate LEFT, RIGHT, and MID extraction.

2

Use LEFT to extract characters from the start

In cell B2, enter =LEFT(A2,5) to extract the first 5 characters. Press Enter to see 'Apple' extracted from your data.

3

Use RIGHT to extract characters from the end

In cell C2, enter =RIGHT(A2,3) to extract the last 3 characters. Press Enter to see 'USA' extracted from the right side.

4

Use MID to extract characters from the middle

In cell D2, enter =MID(A2,7,4) to extract 4 characters starting at position 7. Press Enter to see '2024' extracted from the middle.

5

Copy formulas down and test with multiple rows

Select cells B2:D2, then drag the fill handle down to copy formulas to additional rows. Verify extraction works correctly across all data.

Alternative Methods

Use FIND with MID for dynamic position extraction

Combine MID with FIND to locate a character (like a hyphen) and extract text relative to it without hardcoding positions. Example: =MID(A2,FIND("-",A2)+1,4).

Use Text to Columns feature

Go to Data > Text to Columns to split text by delimiters into separate columns without formulas, useful for one-time conversions.

Tips & Tricks

  • Always count character positions starting from 1, not 0 (Excel uses 1-based indexing).
  • Use LEN function to find total string length: =LEN(A2) helps determine safe extraction positions.
  • Combine these functions with other text functions like TRIM or SUBSTITUTE for powerful data cleaning pipelines.
  • Test formulas with shorter strings first to verify position calculations before applying to large datasets.

Pro Tips

  • Nest LEFT/RIGHT/MID with TRIM to remove spaces: =TRIM(LEFT(A2,10)) ensures clean extraction.
  • Use IFERROR wrapper to handle edge cases: =IFERROR(MID(A2,7,4),"N/A") prevents errors if position doesn't exist.
  • Chain multiple extractions in one formula using CONCATENATE or & operator for complex parsing tasks.
  • Performance tip: These functions are very fast even on large datasets—use them liberally without performance concerns.

Troubleshooting

Formula returns wrong characters or #VALUE! error

Check that your source cell contains text and position/length parameters are numbers. Verify the character position exists in the string using LEN to measure total length.

Extraction cuts off mid-word or leaves trailing spaces

Wrap your formula in TRIM: =TRIM(LEFT(A2,10)) to remove leading/trailing spaces, and recalculate positions if needed.

Copy-pasting formulas breaks references

Use absolute references if needed: =LEFT($A$2,5) for fixed source, or relative references like =LEFT(A2,5) if copying down.

Related Excel Formulas

Frequently Asked Questions

What's the difference between LEFT, RIGHT, and MID?
LEFT extracts from the beginning of a string, RIGHT from the end, and MID from any position in the middle. All three require you to specify how many characters to extract.
Can I extract text based on a delimiter like a comma or hyphen?
Yes, combine MID with FIND to locate delimiters dynamically. Example: =MID(A2,FIND("-",A2)+1,10) extracts text after a hyphen without hardcoding position numbers.
What happens if I ask for more characters than exist?
Excel won't error—it simply returns all available characters from that direction. For example, =RIGHT(A2,100) returns the entire string if it contains fewer than 100 characters.
How do I handle spaces in my extraction?
Spaces count as characters in Excel text functions. Wrap formulas in TRIM to remove leading/trailing spaces: =TRIM(LEFT(A2,10)).

This was one task. ElyxAI handles hundreds.

Sign up