# MID formula generator

> Describe what you need and get a MID formula for Excel and Google Sheets, run on real data before you copy it. Plus 8 tested MID examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/mid · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

MID returns characters from the middle of a text string, starting at a position you choose.

Describe the task at [MID formula generator](https://spreadsheetpractice.com/tools/formula-generator/mid) and get a MID formula for Excel and Google Sheets, tested on real data.

## Tested MID examples

### Extract the first N characters from a cell

`=LEFT(A2,$E$1)`

Excel. Result on the sample sheet: 6 rows (B2:B7). [See it and try it](https://spreadsheetpractice.com/formulas/extract-first-n-characters)

### Extract the last N characters from a cell

`=RIGHT(A2,$E$1)`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/extract-last-n-characters)

### Extract characters from the middle of a text string

`=MID(A2,$E$1,$G$1)`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/extract-characters-from-middle)

### Convert quarter text like "Q1 2026" to a date

`=DATE(RIGHT(A2,4),MID(A2,2,1)*3-2,1)`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/convert-quarter-text-to-a-date)

### Convert YYYYMMDD to a date

`=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2))`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/convert-yyyymmdd-to-a-date)

### Convert dd/mm/yyyy text to a date

`=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2))`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/convert-dd-mm-yyyy-text-to-a-date)

### Remove a leading apostrophe from cells

`=IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2)`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/remove-leading-apostrophe)

### Sum the digits of a number

`=SUMPRODUCT(--MID(A2,SEQUENCE(LEN(A2)),1))`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/sum-the-digits-of-a-number)

## Questions

### What does the MID formula generator do?

You describe the task in plain English, and it writes the formula, using MID where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does MID do?

MID returns characters from the middle of a text string, starting at a position you choose.

### Can I learn to write MID formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the MID function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
