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))