
Originally Posted by
daddylonglegs
Just to refine this a little....
I believe that character 10 also can't be a zero......and I can shorten the part that ensures letters I, O and Q don't appear, so that part of the check can be
=AND(LEN(A2)=17,ISNUMBER(RIGHT(A2,6)+0),COUNT(SEARCH({"I","O","Q"},A2))=0,AND(MID(A2,10,1 )<>{"U","Z",0}))
also to shorten the check digit part you can use a table with the various codes and shorten formula to the following
=SUBSTITUTE(MOD(SUMPRODUCT(LOOKUP(MID(A2,ROW(INDIRECT("1:17")),1),Vincheck), Multi),11),10,"X")&""=MID(A2,9,1)
where Vincheck is a two column table that converts letters/digits to numbers and Multi is a column containing the weights.
Then if you want to you can combine these in one "mega-formula", i.e.
=AND(LEN(A2)=17,ISNUMBER(RIGHT(A2,6)+0),COUNT(SEARCH({"I","O","Q"},A2))=0,AND(MID(A2,10,1 )<>{"U","Z",0}),SUBSTITUTE(MOD(SUMPRODUCT(LOOKUP(MID(A2,ROW(INDIRECT("1:17")),1),Vincheck),Multi),11),10,"X")&""=MID(A2,9,1))
in all cases TRUE means it's valid, see attached
Bookmarks