Set character length limits for cell text inputs in Google Sheets

Use Google Sheets Data validation with LEN formulas to enforce maximum, exact, or range-based character length limits for cells (e.g., SKUs, phone numbers, short descriptions). Choose to warn or reject invalid entries and add custom help text.

What the video covers

This guide shows three Data validation patterns in Google Sheets: maximum length, exact length, and bounded (min–max) length, applied to a selected range using custom LEN formulas.

Watch the video on YouTube

Step-by-step instructions

  1. Open your spreadsheet and select the target range
    In Google Sheets, open the file and highlight the cells or column where you want to limit text length (for example A2:A100). Use the actual top-left cell of that selection in your formulas (e.g., A2).
  2. Open Data validation rules
    From the top menu choose Data then Data validation to open the Data validation rules sidebar for the selected range.
  3. Add a custom formula rule for a maximum length
    Click Add rule, set Criteria to Custom formula is, and enter a formula that uses LEN for the maximum, for example =LEN(A2)=20 to allow up to 20 characters. In Advanced options choose either Show warning or Reject input, add validation help text if desired, then click Done.
  4. Add a custom formula rule for an exact length
    For fixed-length values (e.g., 10-digit SKUs or phone numbers) add a rule with Criteria = Custom formula is and the formula =LEN(A2)=10. Choose Reject input to block mismatches, add help text, then click Done.
  5. Add a custom formula rule for a bounded min–max range
    To require a length between two values, use an AND with LEN. Example: =AND(LEN(A2)=5,LEN(A2)=15). Pick Reject input to enforce it strictly or Show warning to permit but flag invalid entries, then click Done.
  6. Test the validation
    Enter sample strings that are too short, too long, exact, and valid to confirm the rule behavior and that your help text appears when appropriate.

Watch the video

Video thumbnail for Set character length limits for cell text inputs in Google Sheets Play tutorial

Watch on YouTube

Why it matters

Unrestricted text entries can break exports, truncate codes, or disrupt UI layouts. Applying length limits keeps data standardized and prevents invalid submissions.

Check your result

After saving the rule, try entering strings that are within and outside the allowed length for the validated cells. If set to "Reject input," invalid entries should be blocked. If set to "Show warning," invalid entries will be allowed but flagged with a warning icon and your help text.

Troubleshooting

– If validation seems not to apply, confirm the formula references the top-left cell of the selected range (e.g., use A2 when the range starts at A2). – If longer text still appears, check whether the rule is set to "Show warning" instead of "Reject input." – Make sure you clicked Done to save the rule and that no conflicting validation rules exist on the same cells.