Area code from a phone number
| A | |
|---|---|
| 1 | Phone |
| 2 | (415) 555-0100 |
Formula: C2: =MID(A2,2,3)
Result: 415
The area code starts at character 2 and is 3 characters long.
MID with worked examples you can test in the live grid. The argument details are in the Excel guide.
The arguments and common errors are covered in the MID Excel guide; check the function help in Google Sheets for its own argument list.
| A | |
|---|---|
| 1 | Phone |
| 2 | (415) 555-0100 |
Formula: C2: =MID(A2,2,3)
Result: 415
The area code starts at character 2 and is 3 characters long.
| A | |
|---|---|
| 1 | Name |
| 2 | Smith, Jane |
Formula: C2: =MID(A2,FIND(", ",A2)+2,50)
Result: Jane
FIND locates the comma, +2 skips the comma and the space, and 50 is simply a generous length.
| A | |
|---|---|
| 1 | Code |
| 2 | EU-2024-0087 |
Formula: C2: =VALUE(MID(A2,4,4))+1
Result: 2025
MID always returns text; VALUE turns "2024" into a number so +1 works.
A tiny spreadsheet with example data. Edit the formula or any number and see the result.
Formula in D2: =MID(A5,5,4)
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Text | Other | Result | |
| 2 | Alice Johnson | alice johnson | 2026 | |
| 3 | [email protected] | [email protected] | ||
| 4 | extra spaces | |||
| 5 | SKU-2026-0415 | |||
| 6 | iced coffee, tea, sugar | |||
| 7 | Order 417 shipped |
Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.
Enter — commit · F2 — edit · F4 — $ in a reference · Ctrl+C/Ctrl+V — copy and paste · Ctrl+Z — undo
Esc or F6 — leave the sheet for the «Check» button · Shift+Tab in the first cell — back to the page