How can I make my phone number column pick up numbers correctly?

Tevon2.0 1,106 Reputation points
2023-02-14T19:15:01.6766667+00:00

SharePoint Server 2019 On Primise

I am trying to set up a column so that when a user adds an item to my SharePoint list; the home phone column will set the inserted number as in the format of (000)-000-0000

I thought to use the formula below but that didn't work.

=TEXT([Home Phone],"(000)-000-0000")

I also tried to set in the rules below to restrict numbers to 10 digits long.

Formula for Phone number column validation

=LEN(Home Phone)=10

User Message for Column Formula

Home Phone Number must be exactly 10 Digits Long

Is it possible to utilize multiple formulas in a column? If not which is a better option for a phone number column?

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

Accepted answer
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2023-02-15T02:34:52.39+00:00

    Hi @Tevon2.0 ,

    Set the Home Phone column in the format of (000)-000-0000, which can be achieved through JSON format:

    User's image

    
    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "children": [
        {
          "elmType": "a",
          "style": {
            "padding-right": "8px",
            "display": "=if(indexOf(@currentField,'@') > -1, 'block','none')"
          },
          "txtContent": "@currentField",
          "attributes": {
            "target": "_blank",
            "href": {
              "operator": "+",
              "operands": [
                "mailto:",
                "@currentField"
              ]
            }
          }
        },
        {
          "elmType": "span",
          "txtContent": "=if(indexOf(@currentField + '^', '^') == 10,'('+substring(toString(@currentField),0,3)+') '+substring(toString(@currentField),3,6)+'-'+substring(toString(@currentField),6,10),if(indexOf(@currentField + '^', '^') == 7,substring(toString(@currentField),0,3)+'-'+substring(toString(@currentField),3,8),@currentField)",
          "attributes": {
            "class": ""
          }
        }
      ]
    }
    

    User's image

    The steps to set the Home Phone number must be exactly 10 digits are as follows:

    List settings->Validation settings->=LEN([Home Phone])=10

    User's image

    In this way, at the same time, the Home Phone column can be set in the format of (000)-000-0000 and the length of the restricted number must be 10.


    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.

    12 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. rosa 0 Reputation points
    2024-08-30T18:22:53.9766667+00:00

    pero nunca me dijeron que como me comunico con ustedes

    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.