LEFT, RIGHT, and MID in Excel — Complete Text Extraction Guide (2026) | Sheets & Cells
TEXT FUNCTIONS

LEFT, RIGHT, and MID in Excel

These three functions pull a specific chunk of characters from a text string — from the start, the end, or the middle. They're the foundation of parsing any structured text: extracting area codes from phone numbers, initials from names, product codes from SKUs, or dates from timestamps.

=LEFT(text, [num_chars]) =RIGHT(text, [num_chars]) =MID(text, start_num, num_chars)

What they do: LEFT returns the first N characters. RIGHT returns the last N characters. MID returns N characters starting from a specific position. All three work on any text or number (numbers are converted to their default text form).

CategoryText
IntroducedExcel 97 (all three)
Modern alternativeTEXTSPLIT (365)

What each function does

LEFT is the simplest: give it a string and a number, and it returns that many characters from the beginning. =LEFT("Alice", 3) returns "Ali".

RIGHT is the mirror image: same behavior, but from the end. =RIGHT("Alice", 3) returns "ice".

MID is more flexible: give it a start position and a length. =MID("Alice", 2, 3) starts at position 2 and returns 3 characters, giving "lic". Position 1 is the first character (unlike programming languages that start at 0).

The pairing with FIND and LEN: Rarely do you extract a fixed number of characters. Usually the length depends on the data — extract everything before the "@" in an email, everything after the last "/" in a path. Combine LEFT/RIGHT/MID with FIND or SEARCH to locate the boundary, and with LEN to measure the string. That trio does 90% of text extraction work in Excel.

Syntax breakdown

text Required (all three)

The source string to extract from. Can be a cell reference, a literal string in quotes, or the result of another function. Numbers are automatically converted to text — dates come out as serial numbers unless wrapped in TEXT.

num_chars Optional in LEFT/RIGHT, required in MID

How many characters to extract. In LEFT and RIGHT, defaults to 1 if omitted. Must be zero or positive — negative values return #VALUE!. If num_chars is larger than the remaining string, you get the whole rest of the string with no error.

start_num Required (MID only)

The position of the first character to extract, counting from 1. If start_num exceeds the length of the string, MID returns an empty string. If it's less than 1, MID returns #VALUE!.

5 real-world examples

Example 1: Extract the area code from a phone number

Phone in A2 formatted as "(415) 555-0123":

=MID(A2, 2, 3)

Result: 415. Starts at position 2 (skipping the open parenthesis) and takes 3 characters.

Example 2: Extract the domain from an email address

Email in A2 like "alice@example.com". Get everything after the @ symbol:

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

Result: example.com. FIND locates the @, MID starts one position after it, and taking LEN characters guarantees getting to the end.

Example 3: Extract the file extension from a filename

Filename in A2 like "report-2026.xlsx". Get "xlsx":

=RIGHT(A2, LEN(A2) - FIND("~", SUBSTITUTE(A2, ".", "~", LEN(A2)-LEN(SUBSTITUTE(A2,".","")))))

Result: xlsx. Complex, but robust: finds the last dot even in filenames with multiple dots. In Excel 365, use TEXTAFTER for a much cleaner solution.

Example 4: Extract the first name from a full name

Full name in A2 like "Alice Chen". Get "Alice":

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

Result: Alice. FIND locates the first space; LEFT takes everything before it. The -1 excludes the space itself.

Example 5: Extract a code segment from a structured SKU

SKU in A2 like "PROD-2026-XL-BLU". Get just the size code "XL":

=MID(A2, FIND("-", A2, FIND("-", A2)+1) + 6, 2)

Result: XL. Nested FINDs locate the second dash; add offset to skip the year, take 2 characters. In practice, TEXTSPLIT with a hyphen delimiter is much cleaner for structured codes.

Common errors and how to fix them

#VALUE!

Usually caused by negative num_chars or negative start_num. Check that your character-count formulas produce positive numbers — often this happens when a FIND fails and returns an error that propagates.

Empty result from MID

Means start_num is beyond the string length. Not an error — just an empty return. Check with LEN whether the source string is as long as you expected.

Numbers coming out wrong (dates as serial numbers)

Extracting from a cell that contains a date returns characters of the serial number (like "45732"), not the formatted date. Wrap the source in TEXT first: =LEFT(TEXT(A2, "yyyy-mm-dd"), 4) gives the year.

Extra spaces or invisible characters

Extraction from imported data often carries hidden characters (non-breaking spaces, CR/LF, etc.) that offset your positions. Preprocess with TRIM and CLEAN: =LEFT(CLEAN(TRIM(A2)), 5).

When to use each — and when to use TEXTSPLIT

FunctionBest forWatch out for
LEFTFixed-length prefixes (first N chars)Length varies by row — use with FIND
RIGHTFixed-length suffixes (last N chars)Complex when extension length varies
MIDSubstrings from known positionsPosition must be calculated when data varies
TEXTSPLITStructured data with delimitersExcel 365 only; overkill for one-char extracts
TEXTBEFORE / TEXTAFTEREverything before or after a delimiterExcel 365 only; much cleaner than FIND+LEFT

Version compatibility

Excel 365✓ Full
Excel 2024✓ Full
Excel 2021✓ Full
Excel 2019✓ Full
Excel 2016✓ Full
Excel Online✓ Full
Excel Mac✓ Full
Google Sheets✓ Full

Download the practice workbook
Every example above, plus 15 more extraction patterns for emails, phone numbers, SKUs, URLs, and dates.

📥 left-right-mid-practice.xlsx (coming soon)

Related functions

Frequently asked questions

What's the difference between LEFT and MID starting at position 1?

Functionally identical. =LEFT(A2, 5) and =MID(A2, 1, 5) return the same result. LEFT is shorter and clearer for prefix extraction. Use MID when you need to start anywhere other than position 1.

Why does MID start at position 1 and not 0?

Because Excel formula functions use 1-based indexing throughout. Position 1 is the first character. This is a common source of off-by-one confusion for people coming from programming languages that start at 0.

How do I extract the last word of a string?

Combine RIGHT with SUBSTITUTE and FIND: =TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 100)), 100)). In Excel 365, use TEXTAFTER: =TEXTAFTER(A2, " ", -1) — the -1 means "last occurrence." Much cleaner.

What happens if num_chars is larger than the string?

No error — LEFT and RIGHT return the entire string. MID returns everything from start_num to the end. This is by design so you don't need to check length before extracting "up to N characters."

Can I use these functions on numbers or dates?

Yes, but Excel converts them to their raw stored form first. A date is stored as a serial number, so =LEFT(date, 4) gets the first 4 digits of that serial. Wrap in TEXT to preserve formatting: =LEFT(TEXT(A2, "yyyy-mm-dd"), 4) gets the year.

Are LEFT/RIGHT/MID case-sensitive?

The extraction itself preserves case — =LEFT("Alice", 3) returns "Ali" with the original capitalization. If you're pairing with FIND (case-sensitive) or SEARCH (case-insensitive) to locate positions, that's where case matters.

How do these compare to Power Query text extraction?

Power Query is more powerful for bulk transformations across many columns — it has richer built-in patterns like "Extract Text Between Delimiters." But for a single-cell formula in a report, LEFT/RIGHT/MID (or TEXTSPLIT in modern Excel) are simpler. Use PQ when you're transforming an entire dataset; use these when you need a live formula.

Extract any part of any string — with the Sheets & Cells AI Add-in

Describe what you want to pull out ("get the area code," "get the first name," "get everything after the last dash") and the Add-in writes the LEFT/RIGHT/MID formula — with FIND and LEN wrapped correctly. All inside Excel.

Learn about the Add-in →