/docs/community?hl=en
This content is likely not relevant anymore. Try searching or browse recent questions.
SHEETS phone number data validation 1 Recommended Answer 3 Replies 64 Upvotes
1 Recommended Answer
$0 Recommended Answers
1 Relevant Answer
$0 Relevant Answers
How do I perform data validation for a phone number field [i.e. (nnn) nnn-nnnn, or perhaps nnn-nnn-nnnn].
Thanks in advance for any insight you can provide.
Details
Community content may not be verified or up-to-date. Learn more.
Recommended Answer Recommended Answers (1)
Recommended Answer
Most Relevant Answer
Hi, John,

Assuming the phone numbers are being entered into column A
Step 1:
Select column A1:1000 and then select Data validation
Step 2:
Select Custom formula and enter the following custom formula into the field
=regexmatch(A1,"^(\(\d{3}\)\s\d{3}-\d{4}|\d{3}-\d{3}-\d{4})$")
and click Save.
This Data validation will accept both options (nnn) nnn-nnnn or nnn-nnn-nnnn only and reject anything else. In this case, both options will be acceptable.
But if you only want to allow one of the choices then you can use any one of the following for your preference.
(nnn) nnn-nnnn
=regexmatch(A1,"^(\(\d{3}\)\s\d{3}-\d{4})$")
or
nnn-nnn-nnnn
=regexmatch(A1,"^\d{3}-\d{3}-\d{4})$")
Hope you find this useful.
Ben Liebrand
Original Poster
marked this as an answer Recommended based on info available
Our automated system analyzes replies to choose the one that's most likely to answer the question. If it seems to be helpful, we may eventually mark it as a Recommended Answer.
Most relevant based on info available
Our automated system analyzes the replies to choose the one that's most likely to answer the question.
Helpful?
Most Relevant Answer Most Relevant Answers (0)
All Replies (3)
Recommended Answer
Most Relevant Answer
Hi, John,

Assuming the phone numbers are being entered into column A
Step 1:
Select column A1:1000 and then select Data validation
Step 2:
Select Custom formula and enter the following custom formula into the field
=regexmatch(A1,"^(\(\d{3}\)\s\d{3}-\d{4}|\d{3}-\d{3}-\d{4})$")
and click Save.
This Data validation will accept both options (nnn) nnn-nnnn or nnn-nnn-nnnn only and reject anything else. In this case, both options will be acceptable.
But if you only want to allow one of the choices then you can use any one of the following for your preference.
(nnn) nnn-nnnn
=regexmatch(A1,"^(\(\d{3}\)\s\d{3}-\d{4})$")
or
nnn-nnn-nnnn
=regexmatch(A1,"^\d{3}-\d{3}-\d{4})$")
Hope you find this useful.
Ben Liebrand
Original Poster
marked this as an answer Recommended based on info available
Our automated system analyzes replies to choose the one that's most likely to answer the question. If it seems to be helpful, we may eventually mark it as a Recommended Answer.
Most relevant based on info available
Our automated system analyzes the replies to choose the one that's most likely to answer the question.
Helpful?
Recommended Answer
Most Relevant Answer
Ben, great post in response to US phone number types. But this does not seem to be a solution for all phone numbers regardless of country code. For organizations who must input German/Swedish phone number, it seems to be far to complicated to collect and neatly store (using built-in formatting) something as common as phone numbers. Is there a simple tool we can employ for this?
Original Poster
marked this as an answer Recommended based on info available
Our automated system analyzes replies to choose the one that's most likely to answer the question. If it seems to be helpful, we may eventually mark it as a Recommended Answer.
Most relevant based on info available
Our automated system analyzes the replies to choose the one that's most likely to answer the question.
Helpful?
Recommended Answer
Most Relevant Answer
Hi, Caleb,
As you can see, my solution was based on the information that was presented. So you are correct, it only works for US phone numbers. It would be impossible for the formula to cater for every possibility of phone numbers around the world.
As this post was created by John, it satisfies his request. Therefore, you need to create your own post and give all the details needed to meet your scenario. You will have a better chance of someone offering a solution.
Thank you,
Ben Liebrand
Original Poster
marked this as an answer Recommended based on info available
Our automated system analyzes replies to choose the one that's most likely to answer the question. If it seems to be helpful, we may eventually mark it as a Recommended Answer.
Most relevant based on info available
Our automated system analyzes the replies to choose the one that's most likely to answer the question.
Last edited 11/21/19
Helpful?
This question is locked and replying has been disabled.
Discard post? You will lose what you have written so far.
false
false
Notifications are currently off and you won't receive updates. To turn them on, go to Notifications preferences on your Profile page.
Please follow our content policy when creating your post.
Discard post?
You will lose what you have written so far.
Personal information found
We found the following personal information in your message:
This information will be visible to anyone who visits or subscribes to notifications for this post. Are you sure you want to continue?
A problem occurred. Please try again.
Create Reply
Edit Reply
Link to post
Delete post?
This will remove the reply from the Answers section.
Notifications are off
Your notifications are currently off and you won't receive subscription updates. To turn them on, go to Notifications preferences on your Profile page.
Report abuse
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.
Go to the Legal Help page to request content changes for legal reasons.
Reported post for abuse
Unable to send report.
Report post
What type of post are you reporting?
Post is disrespectful, about third party products or contains unrelated content or personal information.
Post contains harassment, hate speech, impersonation, nudity; malicious, illegal, sexually explicit or commercial content.
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.
Go to the Legal Help page to request content changes for legal reasons.
Reported post for abuse
Unable to send report.
Google user
This reply is no longer available.
Badges
Some community members might have badges that indicate their identity or level of participation in a community.
Google Employee — Google product team members and community managers
Community Specialist — Google partners who help ensure the quality of community content
Diamond Product Expert — Community members with product mastery who help other Google users and Product Experts
Platinum Product Expert — Community members with advanced product knowledge who help other Google users and Product Experts
Gold Product Expert — Community members with in-depth product knowledge who help other Google users by answering questions
Silver Product Expert — Community members with intermediate product knowledge who help other Google users by answering questions
Product Expert Alumni — Former Product Experts who are no longer members of the program
Community content may not be verified or up-to-date.
/docs/threads
//accounts.google.com/ServiceLogin
You'll receive email notifications for new posts at
Unable to delete question.
Unable to update vote.
Unable to update subscription.
You have been unsubscribed
Deleted
Unable to delete reply.
Removed from Answers
Marked as Recommended Answer
Removed recommendation
Undo
Unable to update reply.
Unable to update vote.
Thank you. Your response was recorded.
Unable to undo vote.
Thank you. This reply will now display in the answers section.
Link copied
Locked
Unlocked
Unable to lock
Unable to unlock
Pinned
Unpinned
Unable to pin
Unable to unpin
Marked
Unmarked
Unable to mark
Reported as off topic
/docs/profile/0?hl=en