I want to validate the field for US format phone number(478-857-4578). I used the below code, it works fine for all but one scenario.
If I enter only 4 digit number or below than, the error message
The validation formula has evaluated to an error
is displayed.
But for all other wrong inputs, my custom error message
Please enter phone number in 214-587-5485 format
is displayed.
I wanted to display my custom error message for all invalid inputs. Do I need to change anything in formula?
Formula:
=AND(
LEN([num])=12,
IF(ISERROR(FIND("-", [num],4)),
FALSE,
(FIND("-", [num], 4) = 4)
),
IF(ISERROR(FIND("-", [num],8)),
FALSE,
(FIND("-", [num], 8) = 8)
),
IF(ISERROR(1*CONCATENATE(MID([num], 1, 3), MID([num], 5, 3), MID([num], 9, 4))),
FALSE,
AND(
1*CONCATENATE(MID([num], 1, 3), MID([num], 5, 3), MID([num], 9, 4)) > 1000000000,
1*MID([num], 1, 3) <> 911,
1*MID([num], 5, 3) <> 911
)
)
)