troubleshooting Question

asp script Check digit calculation - 20 digit barcode

Avatar of sparky74
sparky74 asked on
10 Comments1 Solution1129 ViewsLast Modified:

I am writing in asp and have a 19 digit code which i need to formulate to create a check digit for a barcode,

I have the formula, but have no idea on how to write this in asp.

my 19 digit barcode for the example is: 9673169126799000001?

the above number is stored in my database as 'barcode'

the check digit is calcualted based on the formula known as Modulus 10, factor 3:

NB. the positions are numbered from RIGHT to LEFT therefore the checkdigit is in position 1

Operation 1
Starting from position 2 of the barcode, add the digit values in even positions

Operation 2
Multiply the result of operation 1 by 3

Operation 3
starting from position 3 of the code, add the digit values in odd positions

Operation 4
add the results of operation 2 & 3

Operation 5
The check digit is the smallest number, which when added to the result of operation 4, gives a multiple of 10.


Barcode number: 9673169 12 6799 000001?

Operation 1: 1+0+0+9+7+2+9+1+7+9  =45

Operation 2: 45 x 3                             =135

operation 3: 0+0+0+9+6+1+6+3+6      =31

Operation 4:135 + 31                          =166

Operation 5: 170 - 166                       =4

Check digit = 4

Please can you help

Applications and Integrations Consultan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros