To pull part of a cell in Excel, use LEFT to take characters from the start, RIGHT from the end, and MID from a set position in the middle. LEFT(A2,4) returns the first four characters, RIGHT(A2,4) the last four, and MID(A2,5,3) three characters starting at position five. Pair them with FIND or SEARCH to locate a marker like a space or a dash, and the count adjusts itself to each row instead of being a fixed number.
This is a daily job on converted data. PDFs love to jam things together: a reference like INV-2026-0043, a description with the date stuck on the front, an account line that ends in the last four digits. Splitting the whole column at a delimiter is one task, and pulling one specific piece out of every row is a different one. These functions do the second job, leaving the rest of the cell alone.
How do I extract text from a cell in Excel?
Pick the function by where the piece sits in the cell.
| Function | What it does | Example on "INV-2026-0043" |
|---|---|---|
LEFT(text, n) | First n characters | LEFT(A2,3) gives INV |
RIGHT(text, n) | Last n characters | RIGHT(A2,4) gives 0043 |
MID(text, start, n) | n characters from a start position | MID(A2,5,4) gives 2026 |
LEN(text) | Counts characters, used to help the others | LEN(A2) gives 13 |
When every row has the same fixed layout, hard numbers work fine: the invoice prefix is always three letters, so LEFT(A2,3) never needs to change. The trouble starts when the length varies from row to row, and that is where you stop counting characters by hand and let a marker do it.
How do I extract text before or after a specific character?
Use FIND to locate the marker, then feed its position to LEFT or MID. To grab everything before the first dash:
=LEFT(A2, FIND("-", A2) - 1)
FIND returns the position of the dash, and subtracting one stops the result just before it. To grab everything after it, combine MID with FIND so the start point moves to wherever the dash lands. On Microsoft 365 and Excel 2024 this gets far simpler, because two purpose built functions replace the whole FIND and LEFT combination:
=TEXTBEFORE(A2, "-") and =TEXTAFTER(A2, "-")
TEXTBEFORE returns everything ahead of the delimiter and TEXTAFTER everything past it, in one readable step. The catch is version: TEXTBEFORE and TEXTAFTER need Microsoft 365 or Excel 2024, and they do not exist in Excel 2019 or 2021. If you share files with people on older versions, the FIND based formula is the portable choice.
What is the difference between FIND and SEARCH?
Both return the position of one piece of text inside another, but they differ in two ways that matter when your data is inconsistent.
| FIND | SEARCH | |
|---|---|---|
| Case sensitive | Yes, "A" is not "a" | No, case is ignored |
| Wildcards | No | Yes, ? and * work |
| Use it when | The marker case is exact and reliable | Case varies or you need a pattern |
On converted data where capitalization is unpredictable, SEARCH is usually the safer default because it does not care whether the marker came across as uppercase or lowercase. Reach for FIND only when case genuinely distinguishes what you want, for example telling an uppercase code apart from a lowercase word in the same cell.
How do I pull the numbers out of a mixed cell?
When a number sits at a predictable end of the cell, RIGHT or LEFT gets it, but the result comes back as text and needs one more step to become a real number. The common pattern multiplies by one or wraps the result in VALUE:
=VALUE(RIGHT(A2, 4)) or =RIGHT(A2,4)*1
Both force Excel to read the extracted characters as a number you can sum. If the digits are scattered rather than parked at one end, extraction by position stops being practical, and this is the point to switch tools. Flash Fill often reads your intent from a couple of examples, and Text to Columns splits the whole column at a delimiter in one pass. Those live in the splitting a cell into columns guide, which covers the bulk split job that LEFT and RIGHT are the wrong tool for.
LEFT, RIGHT, MID, or TEXTBEFORE: which should I use?
| You want | Best tool |
|---|---|
| A fixed number of characters from the start or end | LEFT or RIGHT |
| A piece from the middle at a known position | MID |
| Everything before or after a marker, older Excel | LEFT or MID with FIND |
| Everything before or after a marker, 365 or 2024 | TEXTBEFORE or TEXTAFTER |
| Split the entire column at a delimiter | Text to Columns, not these functions |
The dividing line is one piece versus the whole column. LEFT, RIGHT, MID, and the TEXT functions each carve one part out of every row and leave the source cell intact, which is what you want when you need a reference number in its own column but still want the full description too. When the goal is to break one cell into several columns and be done with the original, that is Text to Columns.
Why is my extracted number treated as text?
Because LEFT, RIGHT, and MID always return text, even when every character they return is a digit. Excel does not assume that four digits pulled out of a code are meant to be a number, so the result sits left aligned and will not sum. Force the conversion with VALUE() or by multiplying by one, and confirm the fix by checking that the cell now hugs the right edge.
A second, sneakier cause is a stray space riding along with the extracted text, usually because the source cell had one. That invisible character makes two values that look identical fail to match in a lookup and refuse to add up. Wrap the extraction in TRIM, or clean the column first, and the problem disappears. The full rundown of that failure is in the guide on removing stray spaces, which is worth a pass on any converted column before you build formulas on it.
Using text extraction on data converted from a PDF
The realistic sequence starts with a clean conversion. Our PDF to Excel converter keeps the table structure so each field lands in its own cell, but PDFs still hand you the occasional combined column: a description with a date prefix, a reference glued to an amount, an account line ending in the last four digits. That is where LEFT, RIGHT, MID, and FIND earn their place, pulling the one piece you need into its own column without disturbing the rest.
Do the type cleanup in the same pass. An extracted amount is text until you run it through VALUE, and a lookup key with a trailing space will miss, so pair extraction with a quick text to number step wherever the piece you pulled is a figure. If the documents you are working from are bank statements rather than a one off PDF, a tool that turns any statement into clean spreadsheet rows reduces how much slicing you have to do afterward, because the fields arrive already separated.
The short version
LEFT takes from the start, RIGHT from the end, MID from a set position, and LEN counts characters to feed the others. Use FIND or SEARCH to locate a marker so the count adjusts per row, with SEARCH for case insensitive matching and wildcards. On Microsoft 365 or Excel 2024, TEXTBEFORE and TEXTAFTER do the before-and-after job in one step. Extracted digits come back as text, so wrap them in VALUE to make them sum, and TRIM off any stray space that hitched a ride.
Last updated July 2026.