Sharepoint Lists column validation syntax

IMK 581 Reputation points
2023-06-09T10:42:41.03+00:00

Hi

I am looking for a syntax, to check that column content is 5 digit in lenght and content is all numbers.

For example, 00100 is accepted, 0010 is not accepted.

I have troubles to find syntax, that would refer to the column content. When my column name is TestColumn and If I test with

=ISNUMBER(TestColumn)

it tests whether text TestColumn is a number. Obviously it is not so validation gives FALSE. It does not test whether the content in the column, named TestColumn, is a number or not.

If I try with

=ISNUMBER([TestColumn])

and save the column edit, it just removes the brackets and I end up in the situation in the first code example.

What would be the correct syntax to check, whether the content in column, named TestColumn, is only numbers or not?

I have the same kind of problem with the content lenght syntax. I have tried

=IF(LEN(TestColumn)=5

save the column setting edit and open the settings again, syntax has been removed from the validation field.

I just can't figure out what I am doing wrong..??

Microsoft 365 and Office SharePoint For business Windows
{count} votes

Accepted answer
  1. Emily Du-MSFT 51,836 Reputation points Microsoft External Staff
    2023-06-12T05:53:02.65+00:00

    Please use following formula in the list validation.

    =IF(LEN(TestColumn)=5,IF(ISNUMBER(TestColumn+0),TRUE,FALSE),FALSE)

    Result:
    1.If the column contains letter,

    1

    2.If the column contains 6 number,

    2

    3.If the column contains 5 number,

    3


    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.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. IMK 581 Reputation points
    2023-06-12T07:44:51.0266667+00:00

    Thank you! This worked.

    0 comments No comments

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.