Forum Discussion

Acorn999's avatar
Acorn999
Brass Contributor
Nov 14, 2022

Validate Column is either NULL or has 11 characters

The SharePoint List has a Single Line of Text Column.

In this column any combination of letters and numbers can be entered.

I need these two validations to run:

1] The field can be NULL / BLANK / Can be left blank

OR

2] IF the field has a data entry, it must be 11 characters. Not less than 11, not more than 11.

 

Require that this column contains information is not checked in all cases. 

 

Another way to summarize:

Allow either zero characters or 11 characters, else show the validation.

 

nothing I have tried works. 

 

=LEN([MEMBERMBI])=11

Even if the field is not set to require entry, with this validation, the field requires entry. Cannot be NULL.

 

=IF(OR(LEN(MEMBERMBI)=0),(LEN(MEMBERMBI)=11))

With this validation, the field requires entry. Cannot be NULL.

 

=IF(NOT(ISBLANK(MEMBERMBI))),AND(LEN(MEMBERMBI)=11)

SharePoint removes the code on Save, does not like this code.

 

Is there a way to allow either a NULL entry OR if there is an entry, validate on LEN=11?

 

 

  • Acorn999 Try using this validation formula: 

     

    =OR(ISBLANK(MEMBERMBI),LEN(MEMBERMBI)=11)

     

    Note: Sometimes comma(,) does not work in formula (it is based on language or regional settings on your site). So in that case use semicolon(;) instead of comma(,)

     

    Similar threadError in Formula in List Validation Settings


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • Acorn999 Try using this validation formula: 

     

    =OR(ISBLANK(MEMBERMBI),LEN(MEMBERMBI)=11)

     

    Note: Sometimes comma(,) does not work in formula (it is based on language or regional settings on your site). So in that case use semicolon(;) instead of comma(,)

     

    Similar threadError in Formula in List Validation Settings


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    • Acorn999's avatar
      Acorn999
      Brass Contributor
      This resolved the issue. Very appreciated. Also the formula is entered in "column validation" and it works there. If I now go to "list validation" the same formula shows there. Next time for any issue, I will try entering the formula in both places and also try replace comma with semicolon.
  • Acorn999 Where are you adding these formulas, in "column validation" settings or "list validation" settings?

    Try using formula given in my above response in column validation settings (on column settings page).

     

    If it does not work with column validation settings, try list validation settings. You can find steps to add formula at: List validation if then syntax 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.