1

How do you allow dashes (hyphens) to be used in a number column in SharePoint? SharePoint only allows numbers and nothing else in number columns. Is there a formula or a calculated column that can be used to solve this issue?

2 Answers 2

2

As Rodrigo has mentioned you cannot use hyphens on a number column. Another way is to create a single line of text column and use Input mask to force the user to enter value in certain format.

Check the reference: Input mask on textbox in SharePoint list form

You have to enter below script on your list form

<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" ></script>
<script language="javascript" src="http://jquery-joshbush.googlecode.com/files/jquery.maskedinput-1.2.2.min.js" type="text/javascript" ></script>
<script language="javascript" type="text/javascript">
jQuery(function($){
   $("input[title='YourFieldName']").mask("999-999-9999");
});
</script>

The above script will force the user to enter only number in US phone format.

1

You can't use hyphens on a number column (unless is a negative number). You should use a text column with a validation formula.

For example, lets say you want to store a phone number with the format xxx-xxx-xxxx.

The formula then would be:

=AND(AND(NOT(ISERROR(SEARCH("???-???-????",YourFieldName,1))),LEN(YourFieldName)=12),AND(AND(ISNUMBER(MID(YourFieldName,1,3)+0),ISNUMBER(MID(YourFieldName,5,3)+0)),ISNUMBER(MID(YourFieldName,9,4)+0)))

Source: http://techtrainingnotes.blogspot.com.ar/2015/10/sharepoint-column-validation-examples.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.