Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed:
=MID(A2,5,4)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
Edit the grid or formula, then run it through a real spreadsheet engine — no signup.
Sample data — click any cell to edit
Need it for your exact data?
Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.
Yes, they produce identical results. LEFT is just a more readable shorthand when you always start from position 1.
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.
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: