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.

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

More like this

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

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.