Results 1 to 5 of 5

Thread: Calculate Check Digit

  1. #1
    New Member
    Join Date
    Apr 2019
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Calculate Check Digit

    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

  2. #2
    Board Regular
    Join Date
    Oct 2014
    Posts
    88
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Calculate Check Digit

    You click (Ctrl + Shift +Enter) for the end of line formula:

    A
    1 3910037276
    2 {=10 - RIGHT(SUM(MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1)*{1;2;1;2;1;2;1;2;1;2}),1)}
    Last edited by sadboy309; Apr 26th, 2019 at 09:09 AM.

  3. #3
    New Member
    Join Date
    Apr 2019
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Calculate Check Digit

    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!

  4. #4
    MrExcel MVP FormR's Avatar
    Join Date
    Aug 2011
    Location
    UK
    Posts
    6,091
    Post Thanks / Like
    Mentioned
    24 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Calculate Check Digit

    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 by FormR; Apr 26th, 2019 at 09:42 AM.
    [code]your code[/code]

  5. #5
    Board Regular XOR LX's Avatar
    Join Date
    Jul 2012
    Location
    Turin, Italy
    Posts
    4,517
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Calculate Check Digit

    Another normally entered option:

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

    Regards
    Advanced Excel Techniques: http://excelxor.com/

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •