To set a character limit in Excel, select the cells, then go to Data > Data Validation. On the Settings tab, set Allow to Text Length, set Data to less than or equal to, type the limit in Maximum (for example 50), and select OK. Leave the Error Alert style on Stop so Excel actually blocks longer entries.
This guide covers that method step by step, how to add a helpful message, how to catch text that was pasted in (which skips the limit), how to count characters with LEN, and the hard limit of 32,767 characters per cell.
Method 1: Limit characters with Data Validation
- Select the cells you want to limit. Select a column letter to cover the whole column.
- On the Data tab, select Data Validation (in the Data Tools group).
- On the Settings tab, open Allow and choose Text Length.
- Open Data and choose how to compare the length. Common choices are below.
- Type the number of characters in the box or boxes that appear.
- Select OK.

Microsoft’s guide to applying data validation to cells shows the same dialog for Windows, Mac and Excel for the web.
Which Data option do you need?
| You want | Data setting | Values to enter |
|---|---|---|
| No more than 50 characters | less than or equal to | Maximum: 50 |
| Exactly 10 characters (an ID code) | equal to | Length: 10 |
| Between 5 and 20 characters | between | Minimum: 5, Maximum: 20 |
| At least 8 characters | greater than or equal to | Minimum: 8 |
The labels for the boxes change with the option you pick, and the exact wording can vary slightly between Excel versions. Spaces count as characters, so “New York” is 8 characters, not 7.
Add an input message
An input message tells people the rule before they type. In the same dialog, open the Input Message tab, check Show input message when cell is selected, and type a title and message such as “Up to 50 characters.” The message appears when someone selects the cell. It is a hint only; it doesn’t enforce anything.
Set the error alert
Open the Error Alert tab to choose what happens when someone types too much. The Style matters:

- Stop blocks the entry. This is the default and the only style that enforces the limit.
- Warning warns the person but lets them keep the entry.
- Information just tells them, and is the most flexible.
Type a clear message, for example “Product names can be up to 50 characters. You entered too many.” Then select OK.
Method 2: Use a LEN formula for the rule
The LEN function returns the number of characters in a cell, and Microsoft notes that spaces count. Type =LEN(A2) in an empty cell to see how long the text in A2 is.
You can also use LEN as a custom validation rule, which helps if you want to combine a length limit with other checks:
- Select the cells, starting with A2, and open Data > Data Validation.
- Set Allow to Custom.
- In Formula, type
=LEN(A2)<=50, using the first selected cell. - Select OK.
The formula must return TRUE for entries you want to allow.
Catch text that gets past the limit
Data Validation has two gaps you should know about. Microsoft’s more on data validation page says it prevents invalid entries “only when users type data directly in a cell.” Text that is pasted in or copied with the fill handle isn’t checked. And Excel does not automatically check text that was already in the cells before you added the rule.
Circle Invalid Data
- Select Data > Data Tools > Data Validation drop-down arrow > Circle Invalid Data.
- Excel draws a red circle around every cell that breaks the rule.
- Fix the cells, then choose Clear Validation Circles from the same menu if any remain.
Run this after anyone pastes data into the sheet.
Highlight long entries with conditional formatting
For a check that stays on all the time, add a rule that colors any cell over the limit:
- Select the cells, starting with A2.
- Select Home > Conditional Formatting > New Rule.
- Choose Use a formula to determine which cells to format.
- In Format values where this formula is true, type
=LEN(A2)>50. - Select Format, choose a fill color, and select OK twice.
Use a relative reference like A2, not $A$2, so the rule checks each cell on its own. Microsoft’s guide to using formulas with conditional formatting explains why clicking a cell inserts an absolute reference you may need to edit.
Excel’s built-in limit: 32,767 characters
No matter what rule you set, one cell can hold at most 32,767 characters, according to Microsoft’s Excel specifications and limits. You can’t raise this. The same page lists 8,192 characters for a formula and 253 line breaks per cell. The often-quoted 255 is the maximum column width, not a cell limit. There is no character limit setting under Format Cells; Data Validation is the tool for this.
Change or remove a character limit
- Select the cells with the rule and open Data > Data Validation.
- To change the limit, edit the number and select OK.
- To remove it, select Clear All, then OK. Setting Allow back to Any value also removes the rule.
Common problems
- People can still type long text. Check the Error Alert tab. The style must be Stop, and Show error alert after invalid data is entered must be checked.
- Long text appeared anyway. It was probably pasted. Use Circle Invalid Data or the conditional formatting rule above.
- Data Validation is grayed out. Microsoft says you can’t change validation settings if the workbook is shared or protected. Unprotect the sheet first.
- A formula result is too long but no error shows. Validation isn’t rechecked when a formula’s result changes because another cell changed. Use LEN or conditional formatting to monitor formula cells.
If you add notes to explain the rule to other users and want them out of the way later, see how to hide all notes in Excel.
Data validation controls what people type, but it doesn’t stop them overwriting formulas. For that, lock the formula cells and protect the sheet.
Questions
Can I apply a character limit to a whole column?
Yes. Select the column letter before opening Data Validation. The rule then applies to every cell in that column, including new entries.
Does the limit affect text already in the cells?
No. Existing text stays as it is, and Excel won’t warn you about it. Use Circle Invalid Data to find cells that are already too long.
How do I cut text down to the limit?
In a helper column, =LEFT(A2,50) returns the first 50 characters of A2. Copy the results and use Paste Special > Values to replace the originals.
Matt Williams is the writer and editor behind TechInfoHome. He holds a degree in computer science and has more than 10 years of experience working in IT. For the past 5 years he has written online tutorials for Windows, Microsoft Office, Google apps and iPhone, with a focus on clear steps that get readers to a working fix quickly.