Forum Discussion

kalyanittayacs's avatar
kalyanittayacs
New Member
2 years ago
Solved

Logic to get Valid PAN number

Hello Team,   I have to verify valid pan (YES or NO) based on few condition- 1) length of pan should be 5 digit 2)first 5 digits should be letters 3) next 4 digit should be number 4)last 1 digi...
  • Fowmy's avatar
    2 years ago

    kalyanittayacs 

    Please find attached the file.
    You need to add a custom column. Assume you have the data in a column called PAN.

     

    if
            let
                __p = Text.Upper([PAN])
    
            in
                Text.Length(__p) = 10 and 
                List.AllTrue(List.Transform(Text.ToList(Text.Start(__p , 5)), each List.Contains({"A".."Z"}, _ ) )) and 
                List.AllTrue(List.Transform(Text.ToList(Text.Middle(__p , 5, 4)), each List.Contains({"0".."9"}, _ ) )) and 
                List.Contains( {"A".."Z"}, Text.End(__p , 1)) 
        then
            "Yes"
        else
         "No"