Sure, here it is:
This is the textbook definition (per GB Tradacoms Guidelines):

1.      Starting with the right hand digit of the number (excluding the
check digit), sum all the alternate values, reading from right to left.
2.      Multiply the result of Step 1 by 3.
3.      Sum all the remaining digits
4.      Add the result of Step 2 to the result of step 3.
5.      The check digit is the smallest figure which must be added to this
sum to reach a multiple of 10.

For example, to calculate the check digit of the number 501234567890

1.      0 + 2 + 4 + 6 + 8 + 0 = 20
2.      20 X 3 = 60
3.      5 + 1 + 3 + 5 + 7 + 9 = 30
4.      60 X 30 = 90
5.      C = 0

I have a VB function that calculates this digit.  It's based on a the 12
digit EAN code being passed to the function as a parameter called "EAN12".
Here it is:

    Dim dblOdds As Double
    Dim dblEvens As Double
    Dim dblSum As Double
    Dim dblFactor As Double

    dblEvens = Val(Mid(EAN12, 12, 1)) + Val(Mid(EAN12, 10, 1)) +
Val(Mid(EAN12, 8, 1)) + Val(Mid(EAN12, 6, 1)) + Val(Mid(EAN12, 4, 1)) +
Val(Mid(EAN12, 2, 1))
    dblOdds = Val(Mid(EAN12, 11, 1)) + Val(Mid(EAN12, 9, 1)) +
Val(Mid(EAN12, 7, 1)) + Val(Mid(EAN12, 5, 1)) + Val(Mid(EAN12, 3, 1)) +
Val(Mid(EAN12, 1, 1))

    dblSum = (dblEvens * 3) + dblOdds

    dblFactor = 1000 - dblSum

    checkdigit = Right(Str(dblFactor), 1)

In the above example it would work as follows:

1.      dblEvens = 20
2.      dblOdds = 30
3.      dblSum = (20*3)X30 = 90
4.      dblFactor = 1000 - 90 = 910
5.      checkdigit = 0

checkdigit is passed back to the calling subprodedure.

> -----Original Message-----
> From: Chris Hughes [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, June 09, 2000 8:21 AM
> To:   [EMAIL PROTECTED]
> Subject:      EAN numbers
>
> Hello.
>
> Could anybody out there please send me the calculation on how an EAN
> number is calculated.
>
> In particular I need to work out the check digit on the end if I already
> have a 12 digit code.
>
> Thanks.
>
> Chris Hughes.
>
> =======================================================================
> To signoff the EDI-L list,  mailto:[EMAIL PROTECTED]
> To subscribe,               mailto:[EMAIL PROTECTED]
> To contact the list owner:  mailto:[EMAIL PROTECTED]
> Archives at http://www.mail-archive.com/edi-l%40listserv.ucop.edu/


**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the individual or entity to
whom they are addressed.  If you have received this email
in error please notify the Wal-Mart E-mail administrator at
" [EMAIL PROTECTED] ".
**********************************************************************

=======================================================================
To signoff the EDI-L list,  mailto:[EMAIL PROTECTED]
To subscribe,               mailto:[EMAIL PROTECTED]
To contact the list owner:  mailto:[EMAIL PROTECTED]
Archives at http://www.mail-archive.com/edi-l%40listserv.ucop.edu/

Reply via email to