Calculating a CHECKSUM on a UPC will help you validate that it is, indeed, a valid Barcode. To do this in EXCEL you can use this formula. Just COPY+PASTE and REPLACE "B142" with the cell you are trying to validate
=IF(LEN(B142)<12,FALSE,TEXT(10-MOD(((MID(B142,1,1)+MID(B142,3,1)+MID(B142,5,1)+MID(B142,7,1)+MID(B142,9,1)+MID(B142,11,1))*3)+MID(B142,2,1)+MID(B142,4,1)+MID(B142,6,1)+MID(B142,8,1)+MID(B142,10,1),10),"0")=TEXT(RIGHT(B142,1),"0"))
Here is some more information about how the UPC check digit is calculated.
UPC
The final digit of a Universal Product Code is a check digit computed as follows:[2]
- Add the digits in the odd-numbered positions from the right (first, third, fifth, etc. - not including the check digit) together and multiply by three.
- Add the digits (up to but not including the check digit) in the even-numbered positions (second, fourth, sixth, etc.) to the result.
- Take the remainder of the result divided by 10 (ie. the modulo 10 operation). If the remainder is equal to 0 then use 0 as the check digit, and if not 0 subtract the remainder from 10 to derive the check digit.
For instance, the UPC-A barcode for a box of tissues is "036000241457". The last digit is the check digit "7", and if the other numbers are correct then the check digit calculation must produce 7.
- Add the odd number digits: 0+6+0+2+1+5 = 14.
- Multiply the result by 3: 14 × 3 = 42.
- Add the even number digits: 3+0+0+4+4 = 11.
- Add the two results together: 42 + 11 = 53.
- To calculate the check digit, take the remainder of (53 / 10), which is also known as (53 modulo 10), and if not 0, subtract from 10. Therefore, the check digit value is 7. i.e. (53 / 10) = 5 remainder 3; 10 - 3 = 7.