Column validation that checks if a column contains a backslash (\)

Pontus Byqvist 0 Reputation points
2024-03-05T06:25:38.19+00:00

Is there any way that you can add a column validation that checks if a column contains a backslash character or not? The thing is that I use the following values for a specific column:

[domain][backslash][user ID] (for example, US\ABC123)

I want to make sure that the domain and the backslash is entered and not only the user ID. The thing is that the domain varies between 2-4 letters and the user ID is not always the same amount of letters either. How do you best go about creating a column validation in this case?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,795 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AllenXu-MSFT 20,966 Reputation points Microsoft Vendor
    2024-03-05T09:04:13.6933333+00:00

    Hi @Pontus Byqvist,

    Apply this formula to the column:

    =AND(FIND("\",[ColumnName])>=3,FIND("\",[ColumnName])<=5)

    This formula means that the input text should contain "" and the number of characters before "" should be between 2 and 4.

    Test result:

    validation


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.