How to Make Variable Data Labels? A Database Perspective with 3 Tools: Excel/VBA/SQL
💡 💡 At a Glance
Variable data labels (VDP) achieve independent encoding for each label through digital printing, widely used in product traceability, anti-counterfeiting inquiry, and logistics tracking.
Last week, a client in the daily chemical product industry asked me: "I want a unique-code label for each product. How do I do that?"
I said: "3 steps—data + template + printer—but there are many tool combinations."
He asked, "What tools should I use?"
I said: "Each of the 3 tools has a different database perspective—Excel (row-based data) / VBA (programming) / SQL (structured queries). This article won't explain 'what variable data is'—it covers the database perspective of the 3 tools + 4 types of printers + a complete 7-step workflow."
3 Tools from a Database Perspective
Tool 1: Excel (Row-Based Data)
Structure: Each row = one label, each column = one variable
| Serial No. | Product Name | Production Date | Batch | Sales Region | |------------|--------------|-----------------|-------|--------------| | A001 | Shampoo | 2024-01-15 | 001 | Beijing | | A002 | Shampoo | 2024-01-15 | 001 | Shanghai |
Advantages:
- Everyone knows how to use it
- Free
- Perfect for small batches of 100-1000
Limitations:
- Inefficient with more than 5 variables
- Cannot connect to external databases
- Excel lags with over 100,000 rows
Typical Scenarios: Emerging brand startups, product samples, internal traceability.
Tool 2: VBA (Programmatic Automation)
Structure: Use VBA programming to generate labels + link with Excel data
Advantages:
- Automation (program once, use forever)
- Supports complex rules (e.g., automatic serial number generation)
- Can connect to Excel + printers
Limitations:
- Requires VBA programming knowledge
- Cannot connect to external databases (requires ODBC)
Typical Scenarios: Medium batches, with programmer support, complex rules (e.g., serial numbers + check digits).
Tool 3: SQL (Structured Query)
Structure: Use SQL statements to query databases + generate label data
Advantages:
- Connects to millions of database records
- Complex queries (multi-table JOIN)
- Enterprise-level application
Limitations:
- Requires SQL knowledge
- Requires supporting label printing software
Typical Scenarios: Large enterprises, millions of records, real-time database connection.
Comparison of 3 Tools
| Dimension | Excel | VBA | SQL |
|---|---|---|---|
| Data Volume | 10,000 rows | 100,000 rows | Millions |
| Learning Difficulty | Low | Medium (requires programming) | High (requires database) |
| Cost | 0 | 0 | 0–100,000 |
| Automation | None | High | High |
| Suitable For | Beginners / small batches | With programmers | Enterprises / large batches |
4 Printer Options
Printer 1: Laser Printer
Features:
- Black & white / color
- Under 1,000 sheets
- 0.05-0.1 RMB per sheet
Suitable for: Internal traceability, office labels.
Printer 2: Inkjet Printer
Features:
- Vivid colors
- 100-5,000 sheets
- 0.1-0.2 RMB per sheet
Suitable for: Cosmetics, food labels.
Printer 3: Thermal Transfer Label Printer (Zebra / Brother)
Features:
- Durable 5+ years
- Professional labels
- 0.2-0.5 RMB per sheet
Suitable for: Warehousing / logistics / industrial traceability.
Printer 4: Digital Printing Press
Features:
- 5,000+ sheets
- Print from 1 sheet
- 0.3-1 RMB per sheet
Suitable for: Cosmetics / premium labels / small-batch customization.
7-Step Complete Process
Step 1: Prepare the Data Source
Excel Example:
- Serial numbers A001-A999
- Product names (identical / slightly varied)
- Dates (auto-generated)
Step 2: Choose a Tool
Beginner: Excel (preferred)
Intermediate: VBA (requires a programmer)
Enterprise: SQL + Bartender
Step 3: Design the Label Template
Key Elements:
- Fixed information (brand LOGO / company name)
- Variable areas (serial number / date / batch)
- QR code (unique on each label)
Step 4: Link the Data Fields
Excel Mail Merge:
- Word template + Excel data
- Each variable maps to a data column
Step 5: Preview the Output
Must-Check:
- Sheet 1 + Sheet 100 + Sheet 1000
- Verify variables are populated correctly
- Verify the QR code is scannable
Step 6: Choose a Printer
Under 100 sheets: Laser / Inkjet
100-1000 sheets: Inkjet / Thermal Transfer
1000+ sheets: Thermal Transfer / Digital Printing
Step 7: Batch Printing
3 Key Cautions:
- Print 5 sheets first and scan-test
- Stop and inspect every 100 sheets
- Keep 5 sheets as backup
3 Tiered Enterprise Solutions
Solution 1: Individual / Small Business (Investment: 0 USD)
Combination: Excel + Word Mail Merge + Laser Printer
Capabilities:
- 100-1,000 labels/month
- 1-3 variables
- Basic traceability
Solution 2: Mid-Sized Enterprise (Investment: 10,000-50,000 USD)
Combination: Access + Bartender Software + Industrial Thermal Transfer Printer
Capabilities:
- 1,000-50,000 labels/month
- 10+ variables
- Production traceability + batch management
Solution 3: Large Enterprise (Investment: 50,000-500,000 USD)
Combination: MySQL + NiceLabel Software + Digital Printing Press
Capabilities:
- 50,000+ labels/month
- Real-time database connection
- One product one code + anti-counterfeiting + marketing
If you would like to view label files — refer to label printing file preparation, or directly contact a LeXiang Packaging consultant, a variable data solution + tool selection will be delivered to you within 24 hours.
FAQ
What must a cosmetic label contain?
12 mandatory items: (1) Product name + trademark; (2) Net content (g / ml); (3) Ingredient list (in descending order of content); (4) Full name + address of manufacturer / distributor; (5) Production license number (starting with XK); (6) Special cosmetics registration number (Guozhuang Tezi); (7) General cosmetics filing number (province abbreviation + G + number); (8) Production date + shelf life (or expiration date); (9) Storage conditions; (10) Directions for use; (11) Precautions; (12) Warning statements. Missing one item = delisting risk.
What is GB 5296.3 for cosmetic labels?
GB 5296.3 'Instructions for Use of Consumer Products - General Labels for Cosmetics' is a national mandatory standard, implemented in 2008. It requires cosmetic labels to contain 12 mandatory items. Penalties for non-compliance: (1) Order to rectify; (2) Fine of 10,000-30,000 yuan; (3) Order to suspend production in serious cases; (4) Sellers also bear joint liability. It is recommended to check each item against the standard before launching any cosmetic product.
What is the difference between a cosmetic filing number and a registration number?
3 differences: (1) Applicability — filing number (province abbreviation + G + number) is for non-special cosmetics, registration number (Guozhuang Tezi + year + number) is for special cosmetics; (2) Process — filing takes 2-3 months, registration takes 1-2 years; (3) Submission materials — filing requires ingredients + process + test reports, registration requires a full set of safety data. General cosmetics use filing; special cosmetics (hair dye, perm, spot-lightening/whitening, sunscreen, anti-hair loss) use registration.
How is the cosmetic ingredient list ordered?
Ordered by content from highest to lowest (INCI international nomenclature). Rules: (1) Ingredients with content > 1% are listed in descending order; (2) Ingredients with content < 1% may be listed in any order; (3) Fragrance / perfume / colorants may be collectively labeled (example: Fragrance / CI 12345); (4) Preservatives must be listed separately. Incorrect ordering (lower content listed first) = non-compliance. It is recommended to use software to automatically sort by INCI.
What are the pitfalls in cosmetic label design?
5 common pitfalls: (1) False claims — example: whitening / spot removal without registration = non-compliant; (2) Medical terms — example: treat / cure / anti-inflammatory = non-compliant; (3) Absolute terms — example: best / number one / top-tier = non-compliant; (4) Missing ingredient list — especially mandatory for children's cosmetics; (5) Missing filing number — non-special cosmetics must have a filing number. All 5 pitfalls may lead to product delisting.
📚 📚 Related Recommendations
Need a Custom Packaging Solution?
Learn more about packaging, or consult directly for a custom solution and quote
