View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Check Digit:- A Real Challenge!

slight change

=MOD(MOD(11-MOD(SUMPRODUCT(MID(A1,ROW(INDIRECT("1:6")),1)*{13; 11;7;5;3;2}),1
1),11),10)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"C01d" wrote in message
...

Function checkDigit()
num = Range("a1").Value
remainder = (Mid(num, 1, 1) * 13 + Mid(num, 2, 1) * 11 + Mid(num,
3, 1) * 7 + Mid(num, 4, 1) * 5 + Mid(num, 5, 1) * 3 + Mid(num, 6, 1) *
2) Mod 11
check = 11 - remainder

While check = 10
check = check + 1
check = 11 - check
Wend

If check = 11 Then
check = 0
End If

checkDigit = check
End Function


--
C01d
------------------------------------------------------------------------
C01d's Profile:

http://www.excelforum.com/member.php...o&userid=34422
View this thread: http://www.excelforum.com/showthread...hreadid=548907