Dhiraj Tiwary
Dhiraj Tiwary

Reputation: 3

How to put a validation on Google Spreadsheet cell to accept only 10 digit comma separated numbers?

I can use "=AND(ISNUMBER($B2),LEN($B2)=10)", but it restricts me to input only a Single 10 digit number. My requirement is to accept either 1 or N 10 digit comma separated numbers(based on user). Ex: "1234567890,1234567890,1234567890,n..."

Let's say A person can have 2 contact numbers, I just want to restrict the cell to accept only 10 digit comma separated number.

Can it be done directly on Google Sheet? or if there is some other way to achieve it. Please help me out.

enter image description here

Upvotes: 0

Views: 2212

Answers (1)

TheMaster
TheMaster

Reputation: 50573

=REGEXMATCH(TO_TEXT(A2),"^(\d{10})(,\d{10})*$")

Cell range:

A2:A    
  • A2:A needs to be formatted as TEXT.
  • The expression matches 10 \digits and zero or more of , followed 10 \digits.

Upvotes: 3

Related Questions