BARCODE(Item,[BCType])

BARCODE(Item,[BCType])
Item
Cell containing the information to create the barcode from.
[BCType]
OPTIONAL. Type of barcode to create.

BARCODE generates a Barcode image of data automatically or by specifying any of the 14 available types.
I got the foundation for this from How to Create Barcode in Excel - FREE & No Install on YouTube. It uses the URL and the IMAGE function to generate a Barcode. Also see BarcodeAPI.org for details as well as being able to generate a barcode which you can print, get a link, copy as an image, and download it as a PNG.
I accidentally saved the original post and timed out of the edit before posting the formula! Here it is:
Excel Formula:
=LAMBDA(Item,[BCType], LET(
   URL, "https://barcodeapi.org/api/",
   AllTypes, {"Auto", "Aztec", "CODABAR", "Code128", "Code39", "DataMatrix", "EAN13", "EAN8", 
              "ITF14", "PDF417", "QRCode", "RoyalMail", "UPC_A", "UPC_E", "USPSMail" },
   Bct, IF(ISOMITTED(BCType), "Auto", BCType),
   Ret, ISNUMBER(MATCH(Bct, AllTypes, 0)),
   IFS( OR(Item = "?", ISBLANK(Item), BCType = "?"), AllTypes,
        Ret = FALSE, "Invalid Barcode Type. " & CHAR(10) & CHAR(13) & "Valid Types: Auto, Aztec, CODABAR, Code128, Code39, DataMatrix, EAN13, EAN8, ITF14, PDF417, QRCode, RoyalMail, UPC_A, UPC_E, USPSMail",
        TRUE, IMAGE(URL & Bct & "/" & Item)))

Other info: Providing a "?" for either parameter (or just ? in a cell) will provide a spilled row of 15 cells with the Barcode Types available like this:

AutoAztecCODABARCode128Code39DataMatrixEAN13EAN8ITF14PDF417QRCodeRoyalMailUPC_AUPC_EUSPSMail
 
Hi Jerry, do you know if it's possible to set the picture size as a parameter in the URL?

Best regards,

Bas
 
Hi Jerry,
I intend not to use the IMAGE function, because I want to be able to use this api also on Excel versions that don't have the IMAGE-function.
So therefore my question is whether you know its possible to set the image size with a URL parameter also?

Best regards, Bas
 
Hi Jerry,
I intend not to use the IMAGE function, because I want to be able to use this api also on Excel versions that don't have the IMAGE-function.
So therefore my question is whether you know its possible to set the image size with a URL parameter also?

Best regards, Bas
If you go to https://barcodeapi.org/index.html#auto, you can generate the barcode and then download the PNG or copy it and paste it into Excel. I'm not sure when the function was introduced, the link I gave you for the function just says 365.

There is a free Barcode Add-In available that should work with older versions.
 
Hi Jerry, Hi Bas

I think I can help with this, with your permission.
IMAGE indeed can fit or resize but cannot control the source. I understand Bas's question because I have designed some inventory integrated systems.
Steps:
Design (parameters, patterns, symbology spectrum, choose code) - Generate code locally (add in) or remotely (IMAGE for transport) - Transfer solution (monitor display, printer, label printer, ink jet, laser) - Scan and report (mobile app scan in Excel directly)
Based on transfer solution it is mandatory to control densities, resolutions, units, dimensions, formats of the code by its inception process. Margin of errors 0 (zero errors allowed)
The technicality of barcodes is tremendous, and any project gets extremely specific solutions adapted to extremely specific requirements. In real life. A solution for any code in existence is not taken into consideration.

Golden Rule:
The pattern returned when you scan a code should be identical with the pattern that generated that code.

Professional site for all this: TEC-IT Software for Barcodes/QR/2D Codes, Mobile Scanning, Labels

I do not have access now to my old project files, so I rewrote a very simple function that was designed when IMAGE function emerged, to be user friendly and versatile enough for simple scenarios.
The function deals only with 3 of the 2D codes:
QR Code - best symbology spectrum
Data Matrix - good for small labels, good data density (jewelry)
Aztec - still readable if code damaged in some proportion, harsh environments
regex symbology spectrum:
Aztec : [ !"#$%&'()*+,-.\/0-9:;<=>?@A-Z\[\\\]^_`a-z{|}~]+
DataMatrix: ^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$
QR: ^.{1,65535}$

The function:
QR((x,[ty],[oz])([wu],[w],[dpi],[f])

x
: sample or array of patterns to be coded
[ty] : code type: -1, toggle btw showing results and list table of argument values ; 0 or omitted QR,1 DataMatrix, 2 Aztec
[oz] : original size : if omitted or 0 fit cell ; 1 orig size (like in image fction argument sizing)
code inception parameters at the source embedded in the URL string:
[wu] :module width unit : 0 or omitted fit ; 1 min ; 2 mm ; 3 mils ; 4 pixels
[w] : module width : if wu fit or min, any value is ignored otherwise numeric value (list show minimal values examples for dif. units)
[dpi] : dots per inch, if omitted 96 (values btwn 96-600)
[f] : image format : 0 or omitted gif ; 1 jpg ; 2 png ; 3 svg

Excel Formula:
=LAMBDA(x, [ty], [oz],
    LAMBDA([wu], [w], [dpi], [f],
        LET(
            v, {
                "( , | type|", "|orig.size )", "( mod.unt|", "|mod.wdth|", "|DPI |", "|img.frm )";
                "-1 legend", "0-fit cell", "0-fit", "-", "96 (df)", "0-gif";
                "0-QR", "1-orig.size", "1-min", "-", "600(max)", "1-jpg";
                "1-DtMtrx", "", "2-mm", "0.257 -", "", "2-png";
                "3-Aztec", "", "3-mils", "10.102-", "", "3-svg";
                "", "", "4-pix", "1 -", "", ""
            },
            IF(
                ty = -1,
                v,
                LET(
                    z, SWITCH(ty, 0, "QRCode", 1, "DataMatrix", 2, "Aztec"),
                    a, SWITCH(wu, 0, "fit", 1, "min", 2, "mm", 3, "mils", 4, "px"),
                    b, IF(dpi, dpi, 96),
                    c, SWITCH(f, 0, "gif", 1, "jpg", 2, "png", 3, "svg"),
                    IMAGE("https://barcode.tec-it.com/barcode.ashx?data=" & x & "&code=" & z & "&unit=" & a & "&dpi=" & b & "&imagetype=" & c & "&rotation=0&eclevel=L&modulewidth=" & w, , IF(oz, 2, 0))
                )
            )
        )
    )
)

Notes: numeric arguments corresponding to text arguments reduces input errors and keeps precision of the URL string values
Sometimes it is "uncomfortable" to remember all arguments options when we call a function, especially for a composed lambda that does not even show the second group of arguments of second lambda. IntelliSense shows only the first group of arguments.
For this I have created toggle value -1 of ty type argument to toggle btw the results and the entire table of arguments options.
Meanwhile ty arg stays -1 you have the table of argument options in sight, choose all the arg you need and when you are done change ty to one of the other 3 posib and enjoy the result. Can not be handier than this.

Book1
ABCDEFGHIJ
1
2data sample to be coded
3649735478|doihhvoidoi-240890098/kjhgfghj-rxdtcfvygubhij
498767890|rtyuCTYVUBIN-9876578/FGHjkkjhg-ijuhygtfgyhujUYHGTFDFGHJ
5
6choose the arg values that you need with the table of arg options in sight, as long as ty=-1
7when you finish your choice, change ty value to see the results of your selection ( see next page )
8(0's corespond to the values if arg is omitted)
9=QR(B3:B4,-1)(2,1.53,100,1)
10( , | type||orig.size )( mod.unt||mod.wdth||DPI ||img.frm )
11-1 legend0-fit cell0-fit-96 (df)0-gif
120-QR1-orig.size1-min-600(max)1-jpg
131-DtMtrx2-mm0.257 -2-png
143-Aztec3-mils10.102-3-svg
154-pix1 -
16
17or show arg. table only before filling other arguments values
18=QR(,-1)()
19( , | type||orig.size )( mod.unt||mod.wdth||DPI ||img.frm )
20-1 legend0-fit cell0-fit-96 (df)0-gif
210-QR1-orig.size1-min-600(max)1-jpg
221-DtMtrx2-mm0.257 -2-png
233-Aztec3-mils10.102-3-svg
244-pix1 -
25
Sheet2
Cell Formulas
RangeFormula
B9,B18B9=FORMULATEXT(B10)
B10:G15B10=QR(B3:B4,-1)(2,1.53,100,1)
B19:G24B19=QR(,-1)()
Dynamic array formulas.


images do not show on mini-sheet , see the screen capture

Book1
ABCDEF
1
2649735478|doihhvoidoi-240890098/kjhgfghj-rxdtcfvygubhij
398767890|rtyuCTYVUBIN-9876578/FGHjkkjhg-ijuhygtfgyhujUYHGTFDFGHJ
4
5with arguments that control widh units, width size, resolution, pic format
6=QR(B2:B3,2,1)(2,1.53,100,1)
7  
8 
9
10all arguments ignored(isolate them like this to be easy to scan if you want to check them with your scanner)
11=QR(B2:B3)()
12  
13 
14
Sheet1
Cell Formulas
RangeFormula
B6,B11B6=FORMULATEXT(B7)
B7:B8B7=QR(B2:B3,2,1)(2,1.53,100,1)
D7,D12D7=B7
E8,E13E8=B8
B12:B13B12=QR(B2:B3)()
Dynamic array formulas.


I really hope that helps. It's the most basic stuff I can imagine, in real life I always recommend profesional assistance since things can really go ugly and nobody wants to be held responsible.

codes 1.png
 
Just had a playful idea of how to use codes. 😊 This QRCode is for Jerry only !! 😉✌️

mess.png
 

Forum statistics

Threads
1,223,574
Messages
6,173,146
Members
452,502
Latest member
PQCurious

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top