Validation of identity document Spain

Hello, in Spain 1 or 2 letters are used in the identity document number of a total of 9 digits that it consists of, these are calculated using an algorithm for calculating the check digit, the number is divided between 23 and the rest is replaced by a letter that is determined by inspection.

For example, if the DNI number is 12345678, divided by 23 days of remainder 14, then the letter would be Z: ------ 12345678Z.

http://www.interior.gob.es/web/servicios-al-ciudadano/dni/calculo-del-digito-de-control-del-nif-nie

I have managed to validate the documents that have 8 digits and a letter at the end, but I cannot validate the documents that start with a letter and end in a letter, having to divide the intermediate 7-digit number by 23 and get the remainder to apply the lyrics.

Could someone help me please ?

This is what I have been able to achieve

RIGHT([_THIS],1)=
INDEX(LIST(โ€œTโ€,โ€œRโ€,โ€œWโ€,โ€œAโ€,โ€œGโ€,โ€œMโ€,โ€œYโ€,โ€œFโ€,โ€œPโ€,โ€œDโ€,โ€œXโ€,โ€œBโ€,โ€œNโ€,โ€œJโ€,โ€œZโ€,โ€œSโ€,โ€œQโ€,โ€œVโ€,โ€œHโ€,โ€œLโ€,โ€œCโ€,โ€œKโ€,โ€œEโ€),1+MOD(NUMBER(LEFT([_THIS],8)),23))

0 23 5,392
23 REPLIES 23
Top Labels in this Space