In Excel: use =LEFT(text, n) to take the first n characters, =RIGHT(text, n) to take the last n, and =MID(text, start, n) to take n characters beginning at a position — the three text-extraction functions.
Syntax
Arguments
| Argument | Description | |
|---|---|---|
text | required | The source text or cell to extract characters from. |
num_chars | required | How many characters to return; for MID this is the length of the slice. |
start_num | optional | MID only: the position of the first character to return (1 = the first character). |
Related functions
3 rows
| Ada Lovelace | London | 1815 |
| Grace Hopper | New York | 1906 |
| Alan Turing | London | 1912 |
What this does
LEFT, RIGHT and MID pull a slice of characters out of a longer string. LEFT takes characters from the start, RIGHT from the end, and MID takes a run of characters beginning at a position you give it. LEFT and RIGHT each need just the text and a count; MID needs the text, the starting position, and how many characters to take. Paired with FIND or SEARCH (which return the position of a character such as a space), they split first and last names dynamically without hard-coding lengths. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. Treat “extract numbers from text” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a layout choice that keeps the sheet readable and sortable into a method you can reuse, explain, and defend when the workbook leaves your screen.
A worked example
Take the product code "ABC123" in A2. =LEFT(A2, 3) returns "ABC", =RIGHT(A2, 3) returns "123", and =MID(A2, 4, 3) returns "123" by starting at the 4th character. To split a full name in B2 like "Maria Klein" at the space: =LEFT(B2, FIND(" ", B2) - 1) returns "Maria", and =MID(B2, FIND(" ", B2) + 1, 100) returns "Klein" — FIND locates the space so the formula works whatever the name length. LEFT, RIGHT and MID are the everyday tools for splitting codes, names and IDs into parts — area codes, file extensions, first and last names — especially when teamed with FIND or SEARCH for variable-length data. A practical tip before you scale it up: build it once on a small block of test data, confirm the number against the tool on this page, and only then point it at your real sheet. That one habit catches almost every mistake while it is still cheap to fix, long before a wrong figure reaches a report or a colleague.
In Google Sheets
If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Treat “extract numbers from text” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.
Common mistakes
- Mixing up
MIDarguments — the order is text, start_num, then num_chars, not text, length, start; the second number is where to begin. - Using a fixed number of characters for names or codes of varying length; combine with FIND or SEARCH so the count adapts to each cell.
- Counting
MIDpositions from 0 — the first character is position 1, so=MID(A2, 1, 3)takes the first three characters.
Frequently asked questions
How do I extract text before a space or symbol?
Combine LEFT with FIND: =LEFT(A2, FIND(" ", A2) - 1) returns everything before the first space. Subtracting 1 stops the result just short of the space itself.
What is the difference between MID and LEFT or RIGHT?
LEFT and RIGHT always start at one end of the text, while MID starts at any position you specify. Use MID when the characters you want are in the middle, not at the start or end.
How do I get the last characters of a cell?
Use RIGHT with the count you need: =RIGHT(A2, 4) returns the final four characters. To take everything after a symbol, pair RIGHT with LEN and FIND to compute the remaining length.
Other ways people ask this
This is also commonly searched as “how to change axis from number to text on excel”, “wildfire macro enter text from excel spreadheet”, “excel extract number from text” and “excel formula extract url from hyperlink”. They describe the identical operation, so you are in the right place no matter how you phrased it.
This guide also answers
- excel extract number from text string
Platform & version notes
- If you are on a Mac, nothing here changes except the modifier key: swap Ctrl for ⌘ in every shortcut, and use the Windows/Mac toggle at the top of the page so the keystrokes shown match the keyboard in front of you.
How is it different on a Mac?
Only the keys. Press ⌘ where Windows uses Ctrl; the menus, formulas and result for "extract numbers from text" are the same on macOS as on Windows.
Why do people search for this in so many different ways?
Because the same task has many names. “how to change axis from number to text on excel”, “wildfire macro enter text from excel spreadheet”, “excel extract number from text” all point at the one operation explained on this page, which is why they all lead here.