Extract the first N characters from a cell
=LEFT(A2,$E$1)Excel · result on the sample sheet: 6 rows (B2:B7)
Describe what you need and get a working MID formula for Excel and Google Sheets, tested on real data before you copy it. MID returns characters from the middle of a text string, starting at a position you choose.
Each formula below was calculated on its own sample sheet. Open one to see the sheet, why it works, and to try it yourself.
=LEFT(A2,$E$1)Excel · result on the sample sheet: 6 rows (B2:B7)
=RIGHT(A2,$E$1)Excel · result on the sample sheet: 5 rows (B2:B6)
=MID(A2,$E$1,$G$1)Excel · result on the sample sheet: 5 rows (B2:B6)
=DATE(RIGHT(A2,4),MID(A2,2,1)*3-2,1)Excel · result on the sample sheet: 5 rows (B2:B6)
=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2))Excel · result on the sample sheet: 5 rows (B2:B6)
=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2))Excel · result on the sample sheet: 5 rows (B2:B6)
=IF(LEFT(A2)="'",MID(A2,2,LEN(A2)),A2)Excel · result on the sample sheet: 5 rows (B2:B6)
=SUMPRODUCT(--MID(A2,SEQUENCE(LEN(A2)),1))Excel · result on the sample sheet: 5 rows (B2:B6)
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.
MID returns characters from the middle of a text string, starting at a position you choose.
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.