Google-sheets – Decompose a column into multiple columns with TRUE/FALSE values instead

google sheets

Here is a very small version of what I want to achieve but not able to figure out what exactly should I Google search for –

Column A | Column B
Alice    |  Present
Bob      |  Absent

Should translate to –

          Present    Absent
Alice      True
Bob                   True

So basically, each unique value in column B should become a new column and the intersection of row and column should be True.

Further extension –
Its even more involved, but is this something achievable?-

Convert this –

Column A |  HashTag 1 | HashTag 2 | HashTag 3
Alice    |   corona   | staySafe  | 
Bob      |   lucky    | corona    |  blessed  

to

          corona    staySafe   lucky   blessed 
Alice      True       True
Bob        True                 True    True

Here all HashTag columns are of same weight, but each tag is in different column.

Thanks in advance.

Best Answer

For your first example, where the values are known, you can just create a new column alongside your existing data for each, like this: =if($A1="Alice","Present","Absent")

Having done so, if you want to you can copy the data then 'paste values' back into the same cells and then delete the original B column then it should be as you wanted in the first place.

Your second example could be done in the same way if the potential values are limited. It could be adapted for all use cases using the unique() and transpose() functions. If you want me to spend further time explaining then let me know.

Good luck.