Excel Formula to Limit Text Length
In this article
Use the LEFT function in Excel to truncate text to a specific number of characters. This prevents data overflow, ensures consistency in reports, and avoids display issues in tables or forms. No add-ins or macros are required—this works in all modern versions of Excel, including Excel for Microsoft 365, Excel 2019, Excel 2016, and later.
What You'll Need
- A Microsoft Excel file (.xlsx or .xls) with text data in one or more cells
- Knowledge of the cell reference containing the text you want to limit
- A target character limit (e.g., 20 characters)
Step-by-Step
- Identify the cell containing the text you want to limit. For example, if your long text is in cell A2, you’ll use that as your source.
- Click on the cell where you want the truncated text to appear—this is your output cell. It should be in the same row or column as your source data for easy reference.
- Type the formula: =LEFT(A2, 20). Replace A2 with the actual reference to your source cell. Replace 20 with the maximum number of characters you want to allow.
- Press Enter. The cell will now display only the first 20 characters of the text in A2. If the text in A2 is shorter than 20 characters, it will display the full text without error.
- Copy the formula down to other rows. Click on the output cell, then drag the fill handle (small square in the bottom-right corner of the cell) down to apply the formula to other cells in the column.
- If your text is in a different column, adjust the cell reference accordingly. For example, if your text is in column B, use =LEFT(B2, 20).
- To apply this to an entire column without dragging, select the first output cell, press Ctrl+C to copy, then select the range of destination cells (e.g., C2:C100), and press Ctrl+V to paste.
- Optionally, use absolute references if your source is fixed. For example, if all rows should use the same character limit based on cell D1, use =LEFT(A2, $D$1).
- After applying the formula, verify the results by comparing a few output cells with the original text to ensure truncation is correct and no unintended characters are cut.
Common Mistakes
- Using =LEFT(A2) without a number—this defaults to 1 character, which is rarely useful and causes data loss.
- Typing the formula as LEFT(A2, 20) without the equals sign (=). Excel treats this as plain text, not a formula.
- Using a cell reference that doesn’t exist (e.g., Z999) or referencing a blank cell, which returns a blank result.
- Assuming the formula removes extra spaces. LEFT() includes spaces in the character count. If your text has leading or trailing spaces, they’ll count toward your limit.
- Trying to use LEFT() to limit text in a cell that already has data. The formula must be placed in a new cell; you cannot overwrite the original cell with a formula without losing the original text.
- Using a negative number as the character limit (e.g., =LEFT(A2, -5)), which returns a #VALUE! error.
Tips
- Combine LEFT() with TRIM() to remove unwanted spaces before truncating: =LEFT(TRIM(A2), 20). This ensures spaces aren’t wasting your character limit.
- Use LEN() to check the original length: =LEN(A2) in a helper column to see how long the text is before truncation.
- If you need to add an ellipsis (...) to show text was cut, use: =LEFT(A2, 17)&"...". This gives you 17 characters plus 3 for the dots, totaling 20.
- For dynamic limits based on another cell, store your character limit in a named cell (e.g., "MaxChars") and reference it: =LEFT(A2, MaxChars). This makes adjustments easier across many formulas.
- Always test your formula on a sample of data first—especially if you’re working with mixed content like names, addresses, or product codes with varying lengths.
- Format the output cells as "Text" (right-click > Format Cells > Text) to prevent Excel from interpreting truncated numbers or dates as values.
Troubleshooting
- If the formula shows as text instead of calculating, check that you typed the equals sign (=) at the start. If it’s missing, Excel treats it as a label.
- If you see #VALUE!, the second argument in LEFT() is not a number. Ensure the character limit is entered as a number, not text. For example, =LEFT(A2, "20") will cause this error.
- If the result is blank, the source cell might be empty or contain a non-text value (like a date or number). LEFT() works on text only. Convert numbers to text first using =TEXT(A2, "0").
- If the formula appears correct but doesn’t copy down properly, check that you’re dragging the fill handle and not just copying the cell. Sometimes Excel’s AutoFill feature misinterprets patterns—manually paste the formula if needed.
- If you’re using a formula like =LEFT(A2, 20) and the output cuts off mid-word, consider using a helper column with =IF(LEN(A2)>20, LEFT(A2, 17)&"...", A2) to avoid breaking words and indicate truncation clearly.
- If Excel is in Manual Calculation mode, press F9 to recalculate. Go to Formulas > Calculation Options > Automatic to prevent this issue.
- If the formula works in one cell but not others, check for hidden characters or merged cells. Unmerge cells and ensure the source data is clean.