# Creating formula for Check Digit following ten digit number

#### samual

##### New Member
Hello,

Our exact problem is this: We have a ten digit number, 6134217948, and we need to find a check digit for it. We have a manual formula which invovles multiplying every other number, i.e. 1,4,1,9,8, by two, and then adding the sum of the resulting numbers to the sum of the rest, i.e. 6,3,2,7,4. However if any of the first string of numbers multiplied by two is larger than 9, than it drops the tenths digit and has a one added to it.

For example 1 4 1 9 8 individually multiplied by 2 equals 2 8 2 18 16, which is changed to 2 8 2 9 7.

After this is said and done the two strings are added back together, ie (2+4+2+9+7)+(6+3+2+7+4) and the ones column of the resulting number is subtracted from ten to equal our check digit number.

While we can manage all of this manually, we need help making a formula to mass produce this in excel.

Any help would be very welcome,

Thank You.

### Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

#### Joe Was

##### MrExcel MVP
The only way I know of is with VBA macro code.

#### Jonmo1

##### MrExcel MVP
Is this what you're looking for...

Code:
``=10 - RIGHT(SUM(MOD(MID(\$A2,2,1)*2,10)+(--MID(\$A2,2,1)*2>9),MOD(MID(\$A2,4,1)*2,10)+(--MID(\$A2,4,1)*2>9),MOD(MID(\$A2,6,1)*2,10)+(--MID(\$A2,6,1)*2>9),MOD(MID(\$A2,8,1)*2,10)+(--MID(\$A2,8,1)*2>9),MOD(MID(\$A2,10,1)*2,10)+(--MID(\$A2,10,1)*2>9),--MID(\$A2,1,1),--MID(\$A2,3,1),--MID(\$A2,5,1),--MID(\$A2,7,1),--MID(\$A2,9,1)),1)``

#### pcorpz

##### Active Member
put the upc on cell c4, then on cell d4 put this formula

=ROUNDUP((MID(C4,1,1)+MID(C4,3,1)+MID(C4,5,1)+MID(C4,7,1)+MID(C4,9,1)+MID(C4,11,1))*3+(MID(C4,2,1)+MID(C4,4,1)+MID(C4,6,1)+MID(C4,8,1)+MID(C4,10,1)),-1)-((MID(C4,1,1)+MID(C4,3,1)+MID(C4,5,1)+MID(C4,7,1)+MID(C4,9,1)+MID(C4,11,1))*3+(MID(C4,2,1)+MID(C4,4,1)+MID(C4,6,1)+MID(C4,8,1)+MID(C4,10,1)))

this will give you the check digit.

then on column e, you can put this formula to combine the two

=CONCATENATE(C4,D4)

#### facethegod

##### Well-known Member
Enter a 10 digit nuber in a1 and try this in b1 to get your check digit

Here's my shot confirmed with Ctrl + Shift + Enter

Code:
``=10-(RIGHT(SUM(IF(MID(A1,{2,4,6,8,10},1)*2>9,MOD(MID(A1,{2,4,6,8,10},1)*2,10)+1,MID(A1,{2,4,6,8,10},1)*2))+SUM(MID(A1,{1,3,5,7,9},1)+0),1)+0)``

#### samual

##### New Member
Thanks

Thank you so much! This helped a lot.

Replies
0
Views
242
Replies
0
Views
180
Replies
3
Views
312
Replies
3
Views
135
Replies
4
Views
115

1,181,055
Messages
5,927,863
Members
436,573
Latest member
CMR237

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