Data Validation in SharePoint column won't work

Julie Sebby 1 Reputation point
2022-02-04T18:44:48.363+00:00

I have a column in a SharePoint list called Personal Phone Number that I would like to add data validation to. I would like to validate 10 numbers and two hyphens. In the list settings this column appears as Field = PersonalPhoneNumber. The column is setup as a single line of text.

I cannot get any data validation to work, even basic stuff like equals x or len = 7. I'm new to Sharepoint, and my understanding is that when you have column names with spaces, you need to put the column name in quotes.

These are the expressions I have tried to just see some type of validation (not even working towards my real use case).

="PersonalPhoneNumber"="abc"
=PersonalPhoneNumber = "abc"

=LEN(PersonalPhoneNumber)=7
=LEN("PersonalPhoneNumber")=7
=IF(LEN(PersonalPhoneNumber)=7,TRUE,FALSE)
=IF(LEN("PersonalPhoneNumber")=7,TRUE,FALSE)

My process is as follows...

  1. Add in validation.
  2. Save validation
  3. Go back to the column settings to make sure the validation stayed in there and that I didn't make a small mistake like forgetting the first equals (if you do that SP strips out the whole expression)
  4. Refresh the page
  5. Go to my form and enter a value
  6. Hit save to trigger validation

Thanks in advance

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,525 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,645 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Julie Sebby 1 Reputation point
    2022-02-04T19:22:55.63+00:00

    Update: When I was testing the validation, I was only entering the phone number in the form and hitting save in order to trigger the validation (even though there were many other columns in the form). I expected that the validation would still show up even though the form wasn't complete. That was wrong. So, I entered all data in the form, and data validation started showing up, but it's not working correctly. I have the following data validation formula and I get a data validation error when I shouldn't.

    =IF(LEN("PersonalPhoneNumber")=12,TRUE,FALSE)
    171514-error.png

    0 comments No comments

  2. Julie Sebby 1 Reputation point
    2022-02-04T21:33:28+00:00

    Update: I changed the column name to remove the spaces and it works now, but it seems like I shouldn't have to do that.