Calculate Check Digit

Mogro

New Member
Joined
Apr 26, 2019
Messages
2
Hi All,

I think this should be fairly easy but I am just a bit of an issue getting a formula to work. I need to calculate a check digit for a bar code.

The # is 3910037276

The instructions to figure check digit are as follows:

Work with the leftmost 10 digits.
Starting from the left take the:

First digit (3) times 1 (= 3)
Second digit (9) times 2 (= 18)
Third digit (1) times 1 (= 1)
Fourth digit (0) times 2 (= 0)
Fifth digit (0) times 1 (= 0)
Sixth digit (3) times 2 (= 6)
Seventh digit (7) times 1 (= 7)
Eight digit (2) times 2 (= 4)
Ninth digit (7) times 1 (= 7)
Tenth digit (6) times 2 (= 12)

Add these together – 3 + 18 + 1 + 0 + 0 + 6 + 7 + 4 + 7 + 12 = 58.

Take the last digit of the total (8) and subtract from 10 which gives a check digit of 2.

I appreciate any help you can provide. I did try to search forums for previous threads but didn't see exactly what I need.

Thank you!
MG
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
You click (Ctrl + Shift +Enter) for the end of line formula:

A
13910037276
2{=10 - RIGHT(SUM(MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1)*{1;2;1;2;1;2;1;2;1;2}),1)}

<tbody>
</tbody>
 
Last edited:
Upvote 0
THANK YOU! Will give this a try. I did come up with a solution but not quite as elegant as yours.

I appreciate the help!
 
Upvote 0
Hi, welcome to the forum!

Here is normally entered option you can also try.

=10-MOD(SUMPRODUCT(0+MID(LEFT(A1,10),{1,2,3,4,5,6,7,8,9,10},1),{1,2,1,2,1,2,1,2,1,2}),10)
 
Last edited:
Upvote 0
Another normally entered option:

=10-MOD(SUM(MID(A1,{1,2}+{0;2;4;6;8},1)*{1,2}),10)

Regards
 
Upvote 0
Hmm,

I have a bar code 06378338390 with a check digit of 6

when i put the bar code in with the formulas above, it calculates it as 3
 
Upvote 0
I believe the check digit should be 7, not 6, but the reason you are getting 3 is because if you enter the values as numbers, Excel will drop the leading zero. Enter it as text instead (i.e. with an apostrophe before it).
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,988
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top