IsPhoneNumber()

Tests whether the supplied parameter is a valid phone number in the North American Numbering Plan (NANP). If the phone number is valid, the function returns true. Otherwise, it returns false.

The NANP is used in 25 countries, regions, and territories, the majority of which are in North America and the Caribbean. These locations include the United States and its territories, Canada, and several countries in the Caribbean, the North Atlantic, Polynesia, and Micronesia.

Phone numbers that aren’t part of the NANP always produce a false result. NANP phone numbers produce a false result if they contain any characters other than numbers, parentheses, hyphens, periods, or spaces. See the Usage section for more information.

The IsPhoneNumber() function has one parameter:

  • phoneNumber (string): Required. A variable or function to test for a null value.

The IsPhoneNumber() function returns true for some phone numbers that begin with 922 and 926. When the function identifies an invalid phone number as valid, the entire batch fails.

For best results, only include numbers when you call this function.

The example returns a true result.

Characters other than spaces, dots, dashes, or parentheses produce a false result, even if the number is a valid NANP phone number.

This example uses the same phone number as the previous example, but it includes a plus sign, so it returns false.

This table shows several function calls and the results of each one.

FunctionResultNotes
IsPhoneNumber("647 555 0123")trueThis is a valid Canadian phone number.
IsPhoneNumber("425.555.0185")trueThis is a valid US phone number.
IsPhoneNumber("(829) 555-0142")trueThis is a valid phone number in the Dominican Republic, which is part of the NANP.
IsPhoneNumber("+14255550142")falseThis is a valid US phone number, but it returns false because it includes a plus sign.
IsPhoneNumber("0161 496 0009")falseThis is a valid UK phone number. The function returns false because it isn’t part of the NANP.
IsPhoneNumber("82 517 460 123")falseThis is a valid South Korean phone number. The function returns false because it isn’t part of the NANP.