The function ISPHONE outputs TRUE if the given string is a valid phone number.

This function takes a string as input. It then checks to see if the given string is a valid phone number and outputs TRUE if it is, FALSE if it isn't.


ISPHONE(string) -> result



string (required, type: string | phone)
The string that may or may not be a valid phone number.

Return Values

result (type: boolean)
The result of checking if the given string is a valid phone number; TRUE means that it is and FALSE means that it isn't.


The following example takes the string "(314)325-1156" and checks to see if it is a valid phone number. "(314)325-1156" is missing a country calling code and is thus not a valid phone number:
ISPHONE("(314)325-1156") -> FALSE
The following example takes the input string given in the above example and appends "+1" – the US country calling code – to the beginning. With the addition of a country calling code, this string is now a valid phone number:
ISPHONE("+1(314)325-1156") -> TRUE

The previous examples entered the potential phone number with parenthesis around the area code and a hyphen between the exchange code and the four-digit number. This is not required for the ISPHONE function to recognize a string as a valid phone number. In the following example, ISPHONE recognizes "+13143251156" as a valid phone number despite this string having no parenthesis or hyphens at all:

ISPHONE("+13143251156") -> TRUE

In fact, the ISPHONE function ignores the placement of parentheses and hyphens entirely when evaluating whether the given string is a valid phone number. The following example has hyphens and a parenthesis inserted indiscriminately, and ISPHONE still recognizes it as a valid phone number:

ISPHONE("+13(1-43-25-1156") -> TRUE

However, while ISPHONE allows for such unconventional formatting when it comes to the bulk of the phone number, it is not so lax when it comes to the country calling code. By convention, country codes are prefixed with a plus sign, and without one, ISPHONE will not recognize a string as a valid phone number:

ISPHONE("13143251156") -> FALSE
When determining if a string is a valid phone number, ISPHONE also checks to ensure the area code refers to a valid location. "555" is the standard fake area code: it does not refer to any real location in the US, and thus the string "+15553251156" does not provide a valid phone number:
ISPHONE("+15553251156") -> FALSE



A country calling code is the first thing that must be dialed in order to reach a phone line in another country. Because a country calling code is not required when connecting phones registered in the same region, many people might not think to include their country calling code when entering their phone number into an app. Apps, however, work internationally, and so it is often necessary to declare a country code explicitly. Ensuring this is done correctly by validating a phone number entered by the user is one of the major use cases for ISPHONE. When used in tandem with FORMAT_PHONE, it's possible to construct an app that stores valid phone numbers – including the country code – without requiring users to change their instinctive behavior (resulting in a more seamless user experience overall!). 

Was this article helpful?

0 out of 0 found this helpful

Add comment

Article is closed for comments.