How to Validate Alphanumeric Data in Google Sheets

Published on

“Alphanumeric” refers to a set of characters that includes both alphabetical letters a to z (lowercase or uppercase) and numerical digits 0 to 9.

To validate alphanumeric data in Google Sheets, you can use formulas based on REGEXMATCH. The exact formula depends on whether you want:

  • To allow only letters and numbers (not necessarily both), or
  • To allow only entries that contain both letters and numbers.

Data Validation Rules to Validate Alphanumeric Data in Google Sheets

There are two main validation formulas to know:

  • =REGEXMATCH(A1, "^[A-Za-z0-9]+$")
    This matches strings made up entirely of letters and numbers — no special characters, no spaces. It accepts either letters, numbers, or a mix of both.
  • =AND(REGEXMATCH(A1, "^[A-Za-z0-9]+$"), REGEXMATCH(A1, "[A-Za-z]"), REGEXMATCH(A1, "[0-9]"))
    This strictly requires both letters and numbers — no special characters allowed.
Example of validating alphanumeric data in Google Sheets

How to Apply Data Validation to Validate Alphanumeric Data in Google Sheets

  1. Select the column or range where you want to apply validation (e.g., A:A).
  2. Go to Data > Data validation.
  3. Under Criteria, select Custom formula is.
  4. Enter the formula that fits your rule (one of the two above).
  5. Check Reject input to prevent invalid entries.
  6. Click Done.
Applying a data validation rule to allow only alphanumeric entries in Google Sheets

How to Adjust the Formula for Different Ranges

The formula references the first cell in your selected range.

  • For a single column range like B10:B50, change A1 to B10.
  • For multi-column ranges like A2:B10, use the top-left cell (e.g., A2) in your formula.

Why Validate Alphanumeric Data in Google Sheets?

  • Prevent entry of unwanted special characters.
  • Ensure data consistency in IDs, codes, or usernames.
  • Improve data quality for further processing.

FAQ: Validate Alphanumeric Data in Google Sheets

Q1: Can I allow spaces or special characters in my alphanumeric validation?
No. The formulas above allow only letters and numbers, excluding spaces and special characters.

Q2: How do I require both letters and numbers in a cell?
Use the formula with the AND condition:
=AND(REGEXMATCH(A1, "^[A-Za-z0-9]+$"), REGEXMATCH(A1, "[A-Za-z]"), REGEXMATCH(A1, "[0-9]"))

Q3: What happens if I paste invalid data?
If Reject input is enabled, invalid entries won’t be accepted when typed or pasted.

Q4: Can this validation work for multiple columns?
Yes, just adjust the cell reference in your formula to the top-left cell of your range.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Free Monthly Expense Tracker Template in Google Sheets (Dashboard Included)

Watch the quick walkthrough below to see how to use this Free Monthly Expense...

The Complete Guide to XLOOKUP in Google Sheets (15+ Practical Examples)

The XLOOKUP function largely replaces traditional lookup functions such as LOOKUP, VLOOKUP, and HLOOKUP...

How to Sort and Filter Pivot Tables in Google Sheets (Complete Guide)

Sorting and filtering are two of the most important techniques for analyzing data in...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.