Quote Originally Posted by Rick Rothstein View Post
There is always a VB solution, a UDF (user defined function) in this case...

Code:
Function IsPAN(S As String) As Boolean
  IsPAN = S Like "[A-Za-z][A-Za-z][A-Za-z][A-Za-z][A-Za-z]####[A-Za-z]"
End Function
For those reading this who are unfamiliar with UDFs, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. You can now use IsPAN just like it was a built-in Excel function. For example,

=IsPAN(A1)
Hi

There is one more requirement in this UDF, 4Th Character should be P for Individulas, C for Company & so on.

So how can we check that & also whether we can give output with error instead of say True or False.

EG. Length should be 10, First 5 character should be text, Next 6-9 character should be number, Last character should be text, 4th character should be either of P,H,F,A,T,B,L,J,G.

Thanks & Regards