# Checkdigit

#### mail

##### New Member
I need to calculate a check digit for 20,000 large numbers in excel
I can manually do it as follows:
The Number is 33 digits long, each digit is multiplied alternating 1,2,1,2 the right most figure in the products are added together, the right most figure in the sum is subtracted from ten creating the check digit. ten is not a check digit it would be 0. Any help would be appreciated!
 1 1 5 0 1 2 0 0 0 5 0 1 0 2 4 6 3 2 0 1 3 1 2 6 0 0 0 0 0 2 5 0 0 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 5 0 1 4 0 0 0 10 0 2 0 4 4 12 3 4 0 2 3 2 2 12 0 0 0 0 0 4 5 0 0 1 2 5 1 4 0 2 4 4 2 3 4 2 3 2 2 2 4 5 52 2 10 8 Check Digit

<TBODY>
</TBODY>

### Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the board.

Code:
``````      ----------------A---------------- B
1   115012000501024632013126000002500 8``````

The formula in B1 is

=10 - MOD(SUMPRODUCT(MID(A1, ROW(INDIRECT("1:33")), 1) * MID("12", MOD(ROW(INDIRECT("1:33")) - 1, 2) + 1, 1)), 10)

That works Thanks, How would I modify it for differnt length numners?

See the two 33's in the formula?

Oops:

=MOD(10 - SUMPRODUCT(MID(A1, ROW(INDIRECT("1:33")), 1) * MID("12", MOD(ROW(INDIRECT("1:33")) - 1, 2) + 1, 1)), 10)

I changed the 33's to 51's and it seems to work, I had been doing a replace 10 with 0, but the formula is simpler . How does this formula work in words?
Thanks

The first MID function returns an array of individual digits, the second returns the array {1,2,1,2,...}, the SUMPRODUCT mutiplies them and tallies the sum, the result is subtracted from 10, and the MOD function gives the remainder after successive divisions by 10.

Replies
1
Views
380
Replies
1
Views
338
Replies
0
Views
768
Replies
0
Views
981
Replies
0
Views
301

1,212,096
Messages
6,105,944
Members
447,986
Latest member
dicklim39

### 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.

### Which adblocker are you using?

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

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