Scorring, saving multiple outputs in 1 number

I have seen this practice before several locations

Returning multiple outputs in 1 single number.

for example

If you have list of items:

Red

Blue

Black

Gray

Green

Pink

Yellow

Orange

And then you have a function that need to return, Red yellow, or black orange, or blue gray green.

How can you do that in 1 return? or 1 number?

Answer is as I like to call “Scorring”, which by giving numeric value to each of these items, these values need to be unique so we can calculate them again from the single return number.

Best that I found were these numbers.

1: Red

2: Blue

4: Black

8: Gray

16: Green

32: Pink

64: Yellow

128: Orange

Look familiar? I bet …

Means if we need to return Red blue, our number should be 3

Red black, 5

Red only, 1

if blue black gray, then return 14

red gray pink, it is 31

And so on

This Excel file has formulas needed to break a large number (up tp 1m) into its small parts, again I call it here scorring, not sure what is the official practice name is.