• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Formating

gadiyasunny

New Member
I have a file that has the following columns.

Sr. LastName FirstName MiddleName PAN


I need to find errors in the PAN column. The rules are as under:

1. Form is AAAPA9999A i.e. First 4 Alphabets then 4 Numbers then 1 Alphabet.

2. Fourth Alphabet has to be "P".

3. Fifth Alphabet has to be the First letter of Lastname.

4. Total length has to be 10.


Please let me know some trick for validation of such formatting needs.
 
Hi, gadiyasunny!

First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.

As a starting point I'd recommend you to read the three first green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).

Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.

Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.

And about your question...


Can you please visit below URL for same query..

http://www.excelfox.com/forum/f13/validating-pan-indian-format-409/


with little customization use the below Formula.

Code:
=IF(AND(LEN(A1)=10,MID(A1,5,1)="P",SUMPRODUCT(--(ABS(77.5-(CODE(MID(UPPER(A1),{1,2,3,4,5,10},1))))<13))=6,SUMPRODUCT(--ISNUMBER(--MID(A1,{6,7,8,9},1)))=4),"Person PAN No","Nah!")


@ Haseeb..

We are missing you :)


Regards,

Deb
 
Hi debraj,


I was also trying to solve it by breaking up the conditions in different cells. But here it seems to work completely at one go...excellent.


Can you plz break up the formula and explain...mainly the sumproduct parts...


Kaushik
 
Hi Kaushik ,


I think a lot of people are fascinated by esoteric formula , assuming that devising a complex formula to solve a problem automatically implies a greater intelligence !


Einstein's equation E=mc^2 is probably the simplest equation you will find in all of science. The intelligence behind this equation is one of the greatest in human history.


The UDF given by Rick Rothstein in the same link is logical , simple and elegant. Unless there is a reason not to use it , I think ignoring it is illogical.


Narayan
 
Hi Narayan,


I absolutely agree with you..


We all prefer to have simple things in our life but converting a complex element into a simpler form is not easy for everybody...


I was just looking for explanation of the above formula posted by debraj (sumproduct part).


Kaushik
 
Hi Kaushik,


Code:
SUMPRODUCT(--(ABS(77.5-(CODE(MID(UPPER(A1),{1,2,3,4,5,10},1))))<13))=6


1> Upper(A1) convert charcter's to A to Z, [code]=CODE("A") = 65, =CHAR(90)
= Z.

So all upper character are in between 65 to 90 (average 77.5),

So if any character is in UpperCase, and we deduct 77.5 from if, it will gives you value in between -13 to + 13.

2> ABS(-13 to + 13)[/code] will always produce positive Number from 1 to 13..

3> MID part, will check only 1st , 2nd,.. and 10th cahracter, if it is in between 13 and gives TRUE / FALSE

4> SUMPRODUCTS,

Product part, will Produce 1 * 1 if both side are TRUE. Both side means, one wide with converted charcter less then 13 or not and if it's position is in mention location or not.

If any one FALSE then Product will be 0 (1 * 0 / 0 * 1)


Sum Part will add all answer.. 1 + 1 + 0 + .. if any place, False comes in Product part, then answer will not be 6 and if all are true then aswer will be 6 .( 1 + 1 .. )


Same for second Sumproduct Function


Finally AND function check, if all are TRUE..


@ Narayank991,

Hey you are one of the best Formula Evaluator.. I still remember your 5 page Word Doc of explaining a formula..


Regards,

Deb
 
Hi Debraj,


Thank you for the explanation... make sense.


I also completely agree with you that Narayan is one of best formula evaluator I have ever seen in my life. He has tremendous ability to explain complex things in a very simpler way.


Kaushik
 
Back
Top