To truncate text in Excel, type =LEFT(A2,10) in an empty cell to keep the first 10 characters of A2, then change 10 to the length you want.
This guide covers six methods: LEFT, RIGHT, MID, LEN with LEFT, SUBSTITUTE with FIND, and a custom VBA function, plus how to replace the original text and fix the errors these formulas throw.
1. Using the LEFT function
LEFT returns the first character or characters in a text string, based on the number you give it. The syntax is LEFT(text, [num_chars]).
If num_chars is larger than the text, LEFT returns the whole string. If you leave it out, Excel assumes 1, so =LEFT(A2) returns a single character.
- Click an empty cell next to the text, for example B2 when the text is in A2.
- Type
=LEFT(A2,8)and press Enter. For "Wireless Keyboard and Mouse Combo" the result is "Wireless". - Change
8to the number of characters you want to keep. - Select B2, then drag the fill handle (the small square at the bottom-right corner of the cell) down to copy the formula to the rest of the column.
LEFT never changes A2. The shortened text lives in the formula cell, so the original stays available if you need to change the length later.
2. Using the RIGHT function
RIGHT returns the last character or characters in a text string. The syntax is RIGHT(text, [num_chars]), and the same rules as LEFT apply: a count larger than the text returns all of it, and a missing count means 1.
- Click an empty cell beside the text, such as B2.
- Type
=RIGHT(A2,4)and press Enter to keep the last four characters. For "ACCT-00981234" the result is "1234". - To cut a fixed prefix off the front instead, type
=RIGHT(A2,LEN(A2)-4). For "SKU-48213" the result is "48213". - Drag the fill handle down to apply the formula to the other rows.
Use RIGHT when the part you want sits at the end: the last digits of an account number, a file extension or a year at the end of a label.

3. Using the MID function for precise truncation
MID returns a set number of characters starting at a position you choose. The syntax is MID(text, start_num, num_chars), and all three arguments are required.
The first character in the text is position 1. If start_num plus num_chars runs past the end, MID returns the characters up to the end and adds no spaces.
- Count the position of the first character you want to keep. In "US-NY-10023" the state code starts at position 4.
- Type
=MID(A2,4,2)in an empty cell and press Enter. The result is "NY". - To drop the first N characters and keep everything after them, use
=MID(A2,N+1,LEN(A2)), for example=MID(A2,4,LEN(A2))returns "NY-10023". - Fill the formula down the column.
MID returns empty text when start_num is greater than the length of the text, and a #VALUE! error when start_num is less than 1 or num_chars is negative.

4. Using the LEN and LEFT functions for dynamic truncation
LEN returns the number of characters in a text string, and spaces count as characters. Combined with LEFT, it lets the cut point follow the length of each cell instead of a fixed number.
| What you want | Formula | Example result |
|---|---|---|
| Remove the last 5 characters | =LEFT(A2,LEN(A2)-5) |
"report.xlsx" becomes "report" |
| Remove the last N characters without an error on short cells | =LEFT(A2,MAX(0,LEN(A2)-5)) |
A 3-character cell returns empty text instead of an error |
| Cap text at 20 characters and add an ellipsis | =IF(LEN(A2)>20,LEFT(A2,17)&"...",A2) |
Long titles end in "…" at 20 characters; short ones stay unchanged |
| Keep only cells under a limit, flag the rest | =IF(LEN(A2)>50,"Too long",A2) |
Shows which rows exceed a 50-character field |
LEFT needs num_chars to be zero or greater, so the MAX(0,...) wrapper protects the formula when a cell is shorter than the characters you subtract.
5. Using the SUBSTITUTE and FIND functions to truncate at a specific character
FIND returns the position of a character inside text, so LEFT(A2,FIND("-",A2)-1) keeps everything before the first hyphen. SUBSTITUTE adds control over which occurrence you cut at, because its instance_num argument replaces only that occurrence.
The examples below use "INV-2026-0419-East" in A2. The # sign is a temporary marker, so pick any character that never appears in your data.
| Cut the text | Formula | Result |
|---|---|---|
| Before the first hyphen | =LEFT(A2,FIND("-",A2)-1) |
INV |
| Before the second hyphen | =LEFT(A2,FIND("#",SUBSTITUTE(A2,"-","#",2))-1) |
INV-2026 |
| Before the last hyphen | =LEFT(A2,FIND("#",SUBSTITUTE(A2,"-","#",LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))))-1) |
INV-2026-0419 |
| Before the first space, any case of text | =LEFT(A2,SEARCH(" ",A2)-1) |
The first word of the cell |
| Before a character that may be missing | =IFERROR(LEFT(A2,FIND("-",A2)-1),A2) |
The full text when there is no hyphen |
| Before a delimiter in Excel for Microsoft 365 | =TEXTBEFORE(A2,"-",2) |
INV-2026 |
The last-hyphen formula works by counting hyphens: LEN(A2)-LEN(SUBSTITUTE(A2,"-","")) is the number removed, and that count tells SUBSTITUTE which hyphen to mark.
FIND is case-sensitive and SEARCH is not. Both return #VALUE! when the character is not in the text, which is why the IFERROR version is the safer choice for mixed data.

6. Using VBA for advanced or custom truncation
A custom function suits a rule you reuse across many workbooks or one that is awkward to write as a formula. Press Alt + F11 to open the Visual Basic Editor (on a Mac, press Fn + Alt + F11), then click Insert > Module and paste the code below.
Close the editor and type =TruncateAt(A2,"-") in a cell to keep the text before the first hyphen, or =TruncateLen(A2,20) to cap a cell at 20 characters with an ellipsis.
Save the file as an Excel Macro-Enabled Workbook (.xlsm), because the standard .xlsx format does not store VBA code.
Function TruncateAt(txt As String, delim As String) As String
Dim pos As Long
pos = InStr(1, txt, delim)
If pos = 0 Then
TruncateAt = txt
Else
TruncateAt = Left(txt, pos - 1)
End If
End Function
Function TruncateLen(txt As String, maxLen As Long, Optional suffix As String = "...") As String
If Len(txt) <= maxLen Then
TruncateLen = txt
Else
TruncateLen = Left(txt, maxLen - Len(suffix)) & suffix
End If
End Function
InStr returns the position of the delimiter, or 0 when it is not found, so TruncateAt returns the full text instead of an error. VBA Left returns the whole string when the length is greater than or equal to its length, and Len counts the characters.
You should see: The cell shows the shortened text, and the function appears in the formula autocomplete list as you type =Trunc.
The workbook that holds the module must be open, or the formula returns #NAME?. To use the functions in every workbook, save the module in a workbook saved as an Excel Add-In (.xlam) and turn it on under File > Options > Add-Ins > Manage: Excel Add-ins > Go.
How to replace the original text with truncated text in Excel
A formula column depends on the source column, so deleting the original turns every result into a #REF! error. Convert the results to plain values first.
- Select the cells that contain the truncation formulas.
- Press Ctrl + C to copy them.
- Right-click the first selected cell and choose Paste Special.
- Select Values and click OK. The cells now hold text instead of formulas.
- Delete the original column, or paste the values over it if you want the shortened text in the same place.

How to check text length in Excel with the LEN function
LEN proves the cut landed where you meant it to, which matters when a database field, a product feed or a form has a hard character limit.
- Click an empty cell next to the truncated result, for example C2.
- Type
=LEN(B2)and press Enter. The number is the character count of the shortened text, including spaces. - Fill the formula down and sort or filter the column to spot any value above your limit.
- Compare with
=LEN(A2)if you need to see how many characters each row lost.
Additional tips for effective text truncation
| Tip | Why it helps | Formula |
|---|---|---|
| Clean spaces before you cut | TRIM removes leading, trailing and repeated spaces, so the count starts at the first real character | =LEFT(TRIM(A2),10) |
| Trim the result after a word cut | Cutting at a space position can leave a trailing space in the result | =TRIM(LEFT(A2,SEARCH(" ",A2))) |
| Store the length in one cell | Change one number to resize every result instead of editing each formula | =LEFT(A2,$F$1) |
| Use SEARCH for case-insensitive cuts | FIND treats "Red" and "red" as different text; SEARCH does not | =LEFT(A2,SEARCH("red",A2)-1) |
| Watch for non-breaking spaces | TRIM removes only the standard space character (code 32), not the web non-breaking space (code 160) | =TRIM(SUBSTITUTE(A2,CHAR(160)," ")) |
If the goal is only to stop long text spilling over neighbouring cells, you may not need a formula at all: you can wrap text in the cell and keep every character.
Practical examples and use cases
| Use case | Sample text in A2 | Formula | Result |
|---|---|---|---|
| Short product name for a label | Wireless Keyboard and Mouse Combo | =IF(LEN(A2)>20,LEFT(A2,17)&"...",A2) |
Wireless Keyboard… |
| Last four digits of an account | ACCT-00981234 | =RIGHT(A2,4) |
1234 |
| Username from an email address | [email protected] | =LEFT(A2,FIND("@",A2)-1) |
jane.doe |
| File name without its extension | report.xlsx | =LEFT(A2,LEN(A2)-5) |
report |
| First name from a full name | Marcus Aurelius | =LEFT(A2,SEARCH(" ",A2)-1) |
Marcus |
| Region code from a structured ID | US-NY-10023 | =MID(A2,4,2) |
NY |
A shortened product or customer code often becomes a VLOOKUP lookup value, so check that the truncated keys still match the lookup table exactly.
A fixed-length cut can also turn two different codes into the same key, so remove duplicate values from the column or flag them before you use it.
Excel TRUNC function vs truncating text
Excel has no function named TRUNCATE for text. TRUNC exists, but it works on numbers only: it removes the fractional part of a number and leaves the integer.
| Function | Works on | Example | Result |
|---|---|---|---|
| TRUNC | Numbers | =TRUNC(8.9) |
8 |
| TRUNC on a negative number | Numbers | =TRUNC(-8.9) |
-8 |
| LEFT | Text | =LEFT("Sale Price",4) |
Sale |
| RIGHT | Text | =RIGHT("Sale Price",5) |
Price |
| MID | Text | =MID("Fluid Flow",7,20) |
Flow |
Excel LEFT, FIND and MID formulas not working
#VALUE! error from FIND or SEARCH
The character is not in the text, FIND did not match the case, or start_num is 0 or longer than the text.
- Check that the delimiter really appears in the cell, including its case when you use FIND.
- Switch to SEARCH if case should not matter.
- Remove the
start_numargument or set it to a value between 1 and the text length. - Wrap the formula in IFERROR, for example
=IFERROR(LEFT(A2,FIND("-",A2)-1),A2), so rows without the delimiter keep their full text.
#VALUE! error from MID or LEFT with LEN
MID received a start_num below 1 or a negative num_chars, or LEFT received a negative count because the cell was shorter than the characters subtracted.
- Click the formula cell and press F2 to see which argument the error comes from.
- Make sure
start_numin MID is 1 or higher. - Wrap the subtraction in MAX, for example
=LEFT(A2,MAX(0,LEN(A2)-5)).
Truncated text keeps a space at the end
A formula such as =LEFT(A2,SEARCH(" ",A2)) includes the space at the found position.
- Subtract 1 from the position:
=LEFT(A2,SEARCH(" ",A2)-1). - Or wrap the result in TRIM:
=TRIM(LEFT(A2,SEARCH(" ",A2))).
#N/A error from TEXTBEFORE
The delimiter is not in the text, or instance_num is higher than the number of times it occurs.
- Lower
instance_numto an occurrence that exists in every row. - Add the
if_not_foundargument so missing delimiters return the full text:=TEXTBEFORE(A2,"-",,,,A2).
#NAME? error with a custom VBA truncate function
The workbook that contains the VBA module is closed, or the function is stored in a different workbook.
- Open the workbook that holds the module.
- Save the file as an Excel Macro-Enabled Workbook (.xlsm) so the code is kept.
- For use in every workbook, save the functions as an Excel Add-In (.xlam) and enable it in File > Options > Add-Ins.
Best practices for text truncation in Excel
| Practice | Reason |
|---|---|
| Keep the original column until you have checked the results | Formulas reference the source, and a deleted source turns every result into #REF! |
| Cut at a delimiter rather than a fixed count when the data varies | Names, codes and titles rarely share one length, so a fixed count splits words |
| Guard formulas with IFERROR or MAX | One row without a hyphen or one short cell should not break the whole column |
| Check lengths with LEN before an import | A field limit is enforced by the receiving system, not by Excel |
| Prefer built-in functions over VBA for shared files | A workbook with macros needs the .xlsm format, and the VBA function fails with #NAME? when the module is not available |
Truncate text in Excel FAQ
Is there a truncate function for text in Excel?
No. Excel has no text function called TRUNCATE. TRUNC works only on numbers and removes the decimal part. To shorten text, use LEFT, RIGHT or MID, or combine LEFT with FIND to cut at a character.
How do I cut off text after a certain number of characters in Excel?
Use LEFT with the number of characters to keep, for example =LEFT(A2,25) keeps the first 25 characters of A2. If the cell is shorter than 25 characters, LEFT returns the whole text unchanged.
How do I remove the last few characters from a cell in Excel?
Subtract the number of characters from the length and pass it to LEFT, for example =LEFT(A2,LEN(A2)-3) removes the last three characters. Wrap it as =LEFT(A2,MAX(0,LEN(A2)-3)) to avoid an error on short cells.
How do I remove the first characters from a cell in Excel?
Use RIGHT with the length minus the characters to drop, for example =RIGHT(A2,LEN(A2)-4) removes the first four characters. =MID(A2,5,LEN(A2)) gives the same result by starting at the fifth character.
How do I truncate text after a specific character in Excel?
Find the character with FIND and keep what comes before it with LEFT, for example =LEFT(A2,FIND("@",A2)-1) returns the part of an email address before the @ sign. In Excel for Microsoft 365, =TEXTBEFORE(A2,"@") does the same.
What is the difference between FIND and SEARCH in Excel?
Both return the position of text inside another string, but FIND is case-sensitive and SEARCH is not. SEARCH also accepts the ? and * wildcards. Both return a #VALUE! error when the text is not found.
Can I truncate text in Excel without VBA?
Yes. LEFT, RIGHT, MID, LEN, FIND, SEARCH and SUBSTITUTE cover fixed-length cuts, cuts at a character and cuts at the nth or last occurrence. VBA only helps when you want one named function to reuse across workbooks.
How do I keep the truncated text and delete the original column?
Copy the formula cells, right-click and choose Paste Special, then select Values and click OK. The cells then hold plain text, so you can delete the original column without causing #REF! errors.
Does LEN count spaces in Excel?
Yes. LEN counts every character, including spaces, so a cell with leading or trailing spaces reports a higher number than the visible text. Run TRIM first if those spaces should not count toward a limit.





