Skip to content

LEFT vs MID: extracting text from a start point in Excel and Sheets

Excel & Google Sheets
=MID(A2,5,4)

Verified example

Computed by a real spreadsheet engine on the sample data below.

Code
PRD-2024-001
SVC-2023-999
INV-2025-042

=MID(A2,5,4)2024

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Put a text string in A2, for example "PRD-2024-001".
  2. 2To extract the first 3 characters ("PRD"), use =LEFT(A2,3).
  3. 3To extract the year "2024" starting at position 5, use =MID(A2,5,4). The second argument is the start position (1-based); the third is the number of characters.
  4. 4To extract the last segment when its length varies, combine MID with LEN: =MID(A2,LEN(A2)-2,3) extracts the last 3 characters, though RIGHT is cleaner for that case.
  5. 5Chain FIND or SEARCH to locate a delimiter dynamically, then pass the result +1 as MID's start position: =MID(A2,FIND("-",A2)+1,4) extracts "2024" regardless of what precedes the first hyphen.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Is LEFT(A2,3) exactly the same as MID(A2,1,3)?

Yes, they produce identical results. LEFT is just a more readable shorthand when you always start from position 1.

How do I extract text between two delimiters?

Use MID combined with two FIND calls: =MID(A2,FIND("-",A2)+1,FIND("-",A2,FIND("-",A2)+1)-FIND("-",A2)-1) extracts the segment between the first and second hyphen.

Do LEFT and MID count bytes or characters for multi-byte text?

They count characters (Unicode code points). For byte-level extraction of double-byte text, use LEFTB and MIDB in Excel — these are not available in Google Sheets.

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: