MID
Return a run of characters starting at a given position.
Syntax
MID(text, start_num, num_chars) | Argument | Required | Description |
|---|---|---|
text | Required | The text to take from. |
start_num | Required | Where to start, counting from 1 rather than 0. |
num_chars | Required | How many characters to take. |
Examples
Every example below was executed against VisiGrid engine 0.35.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=MID("Spreadsheet",7,5) | sheet | |
=MID("2026-08-10",6,2) | 08 | The month, from a date stored as text. |
=MID("abc",5,2) | | Starting past the end returns empty text, not an error. |
=MID("a-b",FIND("-","a-b")+1,10) | b | Everything after the first separator — the common pairing with FIND. |
=TEXTAFTER("a-b-c","-") | b-c | TEXTAFTER says the same thing more directly. |
=MID("aé-cd",FIND("-","aé-cd")+1,10) | cd | FIND counts characters, so this is correct on non-ASCII text too. |
Positions start at 1
MID("Spreadsheet", 7, 5) starts at the seventh character. Not the eighth, and
not the sixth — spreadsheets count from one, unlike most programming languages,
and this is where that difference bites most often.
Splitting on a separator
MID on its own needs to know where things are. Combined with
FIND it can work it out:
=MID(A1, FIND("-", A1) + 1, 100)
Everything after the first hyphen. The 100 is simply “more than could be
there” — asking for more characters than exist returns what exists, so there is
no need to compute the remaining length.
For the common cases there are now direct functions, and they read far better:
=TEXTBEFORE("a-b-c", "-") → a
=TEXTAFTER("a-b-c", "-") → b-c
MID with FIND is still what you need for anything they do not cover — a
fixed offset, a run between two different separators, or the nth field of many.
There is no SPLIT that divides a string into several cells at once.
Excel compatibility
Matches Excel, including 1-based positions and empty text past the end.