CALL US :(800) 880-7495 (toll free)

# Carolina Barcode UPC Read Me Warning:  UPC is more complicated that code 3 of 9.  It will NOT scan unless you follow these directions.  Don't let the warnings scare you off, it is not that difficult, but is a little different than *123*.  To add insult to injury, UPC also makes use of a check digit.  A dll is in testing now, but if you know the entire string, you can reproduce it here with very little effort.  Pleas do read the walk through below.  There is a small trick to it.

### Creating your UPC codes

First, start with one of the UPC codes.  These have UPC in the name of the file and include CarolinaBar-UPC-2-18x101x720", among others.  Second, you need a little background.  UPC-A is made of numbers 0 through 9.  Unfortunately, there are four different positions within the UPC character string.  Each of these four positions, have a different barcode, even for the same number.  We have solved this problem by assigning a character for each section to each section of the keyboard.  You will notice in the example below, the barcode 012345123450, is coded using the 0 from the top row of the keyboard.  This is followed by the QWERT from the second row on the keyboard which will display the 12345 on the left of the divider bar.  The hyphen is used as a divider bar, ASDFG gives us the 12345 from the right of the divider bar, and the / is used to give us the final 0. Some other examples:

To build "412345123472", you would type "4QWERT-ASDFJX"

To build "832345123515", you would type "8EWERT-QWETQB"

### Functions for calculating the check digit

We can't help everyone write functions to calculate check digits, but we have included this code sample taken from Excel.  This was actually used to create the test documents that were used to evaluate these codes.  If you would like to get the Excel spreadsheet that this function was used in, click here.

Public Function f_GetUPC(ByVal as_Input As String) As String
Dim ls_Start, ls_Left, ls_Right, ls_Stop As String
Dim ll_Count, ll_Max
Dim ls_Codes As String
Dim ll_Odd, ll_Even, ll_Check As Long

ls_Start = "0123456789"
ls_Left = "PQWERTYUIO"
ls_Right = ";ASDFGHJKL"
ls_Stop = "/ZXCVBNM,."

as_Input = Right(String(11, "0") & as_Input, 11)

If Not IsNumeric(as_Input) Then
as_Input = "*"
Else
ll_Max = Len(as_Input)
For ll_Count = 1 To ll_Max
Select Case ll_Count
Case 1
ls_Codes = ls_Codes & Mid(ls_Start, Mid(as_Input, ll_Count, 1) + 1, 1)
Case 2, 3, 4, 5, 6
ls_Codes = ls_Codes & Mid(ls_Left, Mid(as_Input, ll_Count, 1) + 1, 1)
If ll_Count = 6 Then ls_Codes = ls_Codes + "-"
Case 7, 8, 9, 10, 11
ls_Codes = ls_Codes & Mid(ls_Right, Mid(as_Input, ll_Count, 1) + 1, 1)
End Select
Next
'add up all of the numbers in the odd positions starting with 1
ll_Odd = Int(Mid(as_Input, 1, 1))
ll_Odd = ll_Odd + Int(Mid(as_Input, 3, 1))
ll_Odd = ll_Odd + Int(Mid(as_Input, 5, 1))
ll_Odd = ll_Odd + Int(Mid(as_Input, 7, 1))
ll_Odd = ll_Odd + Int(Mid(as_Input, 9, 1))
ll_Odd = ll_Odd + Int(Mid(as_Input, 11, 1))

'add up all the numbers in the even position starting with 2
ll_Even = Int(Mid(as_Input, 2, 1)) + Int(Mid(as_Input, 4, 1))
ll_Even = ll_Even + Int(Mid(as_Input, 6, 1)) + Int(Mid(as_Input, 8, 1))
ll_Even = ll_Even + Int(Mid(as_Input, 10, 1))

'multiple the odd sumation by 3, add that to the even and mod that by 10.  Subtract the entire amount from 10
ll_Check = 10 - (((ll_Odd * 3) + (ll_Even)) Mod 10)

'if that number is equal to 10, the check digit is 0
If ll_Check = 10 Then ll_Check = 0

'add the check digit to the character string
ls_Codes = ls_Codes & Mid(ls_Stop, ll_Check + 1, 1)

End If

f_GetUPC = ls_Codes

End Function
Information
Categories
Manufacturers