+ Reply to Thread
Results 1 to 3 of 3

Generate Barcode in Single Cell using Product Code in Separate Cell

  1. #1
    Registered User
    Join Date
    01-11-2016
    Location
    England
    MS-Off Ver
    Mac 2011, V14
    Posts
    15

    Generate Barcode in Single Cell using Product Code in Separate Cell

    Hi,

    I have a cell called "Product Code" and I want to use this to generate a barcode in a cell called "Barcode" without using any other cells.

    So, the "Barcode" cell would contain the company prefix, product code and the check digit e.g. "5054492" "22115" "8" (final format should be 5054492221158).

    The formula would be something like: 5054492 (concatenate) "Product Code" (concatenate) "check digit algorithm".



    The algorithm to generate the check digit is below.



    Locate the 12th digit in the barcode.
    For example, if your EAN-13 was 5054492 22115 x, the 12th digit is the No. 5.

    Starting with this 12th digit, move from right to left across the code adding every second digit to it. Using our example code of 5054492 22115 x, this means starting with the No. 5 and adding to it the numbers 1, 2, 9, 4 and 0, giving a total of 21.

    Multiply the sum obtained in Step 2 by 3. Using our example above, this means the multiplying of 21 by 3, giving a total of 63.

    Locate the 11th digit in the code. Using our example code of 5054492 22115 x, this would be the No. 1.

    Starting with the 11th digit, move from right to left across the code adding every second digit to it. Using our example of 5054492 22115 x, this means starting with the No. 1 and adding to it 2, 2, 4, 5 and 5, giving a total of 19.

    Add the results from Step 3 and Step 5. In our example this means adding 63 and 19, giving a total of 82.

    Round the result of Step 6 up to the nearest multiple of 10. In our example, this means rounding 82 up to 90.

    Subtract the result of Step 7 from the result of Step 6. In our example, this is 90-82, giving us a difference of 8. This 8 should be the 13th number in the EAN-13, otherwise known as the check digit.

    Result: 5054492 22115 8



    Thanks

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Generate Barcode in Single Cell using Product Code in Separate Cell

    As a UDF, with the company code hardcoded into the function (this can be modified, if needed)

    If you had "22115" in cell A1, and typed

    Please Login or Register  to view this content.
    into any other cell, the result in that cell would be "5054492221158"

    You MUST put this code in a Module in your workbook for you to access it as a formula.

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    01-11-2016
    Location
    England
    MS-Off Ver
    Mac 2011, V14
    Posts
    15

    Re: Generate Barcode in Single Cell using Product Code in Separate Cell

    Great work, thank you walruseggman.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Create barcode in single cell using product code
    By Paulo19 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-18-2016, 01:06 PM
  2. Help with sum-product in single cell
    By zeband in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-13-2016, 02:48 PM
  3. Generate single cell listing from a column of email addresses
    By rszanti in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 09-10-2015, 04:41 PM
  4. Trying to separate vertical text from a single cell – Mk II
    By Wendy Collins in forum Excel General
    Replies: 0
    Last Post: 01-30-2013, 09:46 AM
  5. Generate random numbers between 1 - 100 in a single cell
    By inepab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 05:08 AM
  6. Replies: 0
    Last Post: 11-13-2012, 12:53 PM
  7. Separate Cases in Single Cell
    By Cheyenne2010 in forum Excel General
    Replies: 4
    Last Post: 02-02-2010, 05:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1