SharePointKID
SharePointKID

Reputation: 91

Validate a Single line of text column type of list in sharepoint 2010 to accept only numbers?

How to validate a Single line of text column type of list in sharepoint 2010 to enter accept only numbers?

Please don't tell me to use calculated column , I tried it and it didn't work for me as i want.

Please advice, thanks in advance.

Upvotes: 3

Views: 9074

Answers (3)

Rob Windsor
Rob Windsor

Reputation: 6859

I went through the available functions and I don't see one that will validate whether a text value is a number.

BTW, is there a reason you are not using a Number field instead of a Single line of text?

Upvotes: 0

Kirk Liemohn
Kirk Liemohn

Reputation: 7933

Here is what seems to work for me (building on @Rob_Windsor; newlines added for readability):

=AND(
  ISNUMBER(Number+0),
  ISERR(FIND(".",Number)),
  ISERR(FIND(",",Number)),
  ISERR(FIND("$",Number)),
  ISERR(FIND("+",Number)),
  ISERR(FIND("-",Number)),
  ISERR(FIND(" ",Number))
)

Upvotes: 1

Rob Windsor
Rob Windsor

Reputation: 6859

This should work:

=ISNUMBER([MyColumn]+0)

Upvotes: 4

Related Questions