Barcode challenge

In this week’s challenge, you need to help your local post office whose package sorting system is broken. The packages have a barcode that, when scanned, are converted into a series of ones and zeroes (bits).

The destination country is written in the barcode. It is determined by the two first bits and by the last bit. Write a formula in column U that outputs the destination of the package.


Drop your solution in the comments below! 🙂

Our solution (solves both medium and hard version):

IF(AND(XOR(M6;N6;);AND(N6;T6));”USA”;”Country not found”))))))

Since the barcodes are represented by bits, we have chosen to solve this challenge with boolean logic. Inside each IF-function we evaluate the specific countries only with logical operators (AND, OR, XOR & NOT).

Read more about boolean logic:

Share on facebook
Share on linkedin
Share on email

    Expanded the Destination table with columns for pos 1, 2, 8. Called it Tdest and used INDEX(MATCH)
    =INDEX(Tdest[Destination];XMATCHNING(1;(N(M6)=Tdest[Pos 1])*(N(N6)=Tdest[Pos 2])*(N(T6)=Tdest[Pos 8])))
    Not figured out how to do it without helper columns. Swedish Excel version.

  • Gustav

    In this case I prefer a solution to pick the right country from a table. But if I only allowed to use one column I made as follows:


  • David

    Inte speciellt originellt eller elegant men:


  • jeffrey


    Kul med dessa pussel. Visste inte att Excel hade en switch statement innan jag fick klura pÄ det. /Jeff

Leave a Reply