← Excel and spreadsheets

LEFT, RIGHT, MID and LEN

Pull characters out of text and count them.

Start this lesson

LEFT(text, n) takes the first n characters and RIGHT(text, n) takes the last n. MID(text, start, n) takes n characters beginning at position start, where the first character is position 1. LEN(text) counts every character, and spaces and dashes count too.

Example: A2 holds the code TX-4827-B.

  1. LEFT(A2,2) = TX — First two characters
  2. MID(A2,4,4) = 4827 — Start at position 4, take 4
  3. LEN(A2) = 9 — Letters, digits and dashes all count

Why it works: Text is a row of characters numbered from 1, including spaces and dashes, so counting positions tells LEFT, RIGHT and MID exactly which characters to take.

Tip: To split a code at a dash without counting by hand, combine MID with FIND to locate the dash.