Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Formula to Limit Text Length

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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).
  7. 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.
  8. 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).
  9. 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.

Frequently Asked Questions

Can I use LEFT() to limit text in a pivot table?

No. Pivot tables don’t allow direct formula editing in their data fields. You must pre-process the source data using LEFT() in a helper column before creating the pivot table.

Does LEFT() work with numbers and dates?

Yes, but only if Excel treats them as text. If a cell contains a number like 123456789, =LEFT(A2, 3) returns "123". If the cell is formatted as a date, LEFT() returns the underlying serial number as text, which is usually not useful.

Can I limit text by words instead of characters?

No, LEFT() only works by character count. To limit by words, use a more complex formula involving SUBSTITUTE(), FIND(), and MID(), but this is unreliable for variable-length words. For most use cases, character limits are more predictable.

Will this formula affect the original data?

No. The LEFT() function creates a copy of the truncated text in a new cell. The original cell remains unchanged. Always keep a backup if the original text is critical.

What if I need to truncate to 255 characters?

You can. LEFT() supports up to 32,767 characters in modern Excel versions. Typing =LEFT(A2, 255) works perfectly. The 255-character limit is an old restriction from early Excel versions and no longer applies.

Can I use this in Google Sheets?

Yes. The LEFT() function works identically in Google Sheets. The syntax and behavior are the same, so any formula you build in Excel can be copied directly into Google Sheets.