The packing export has a status column containing numbers like 5 and 3. Both packages are labeled, but only the first is sealed. The export uses one number to store several independent flags.

Get the flag definitions from the export

For this example, the packing system uses 1 = labeled, 2 = weighed and 4 = sealed. A status of 5 means 4 + 1. A status of 3 means 2 + 1. Use the actual system’s documented values in your sheet.

The packing system uses 1 for labeled, 2 for weighed and 4 for sealed. Mask 5 contains flags 4 and 1.

Illustrated packing flags. Read the numeric definition before decoding.

Mask out the flags you do not need

With the status in A2 and the flag value 4 in B2, enter:

=BITAND(A2,B2)=B2

The bitwise AND keeps only bits set in both numbers. A single flag must be a nonzero power of two. Testing 0 would always return TRUE in this pattern.

Testing flag 4 returns TRUE for mask 5 and FALSE for mask 3.

Illustrated comparison. The other bits can vary without changing the meaning of flag 4.

Try 5, 3 and 0. The test returns TRUE, FALSE and FALSE respectively for flag 4. Keep unknown or blank export values distinct from a confirmed status of zero before filling the formula down.

Microsoft’s Excel function reference