Using a loop to create more columns.

Hi Forum, I would please like some assistance with an issue I am having.

I have the following table:

| ID     | Category     |
| Row148 | History      |
| Row149 | Change Event |
| Row150 | Share        |
| Row151 | History      |
| Row152 | Share        |

I would like to add a new column for each unique value in the Category column and then assign a 0 or a -1 to the row in the new column depending if the value is present in the Category column. So the final layout that I want would be:

| ID     | Category     | History | Change Event | Share |
| Row148 | History      | 0       | -1           | -1    |
| Row149 | Change Event | -1      | 0            | -1    |
| Row150 | Share        | -1      | -1           | 0     |
| Row151 | History      | 0       | -1           | -1    |
| Row152 | Share        | -1      | -1           | 0     |

Any assistance would be greatly appreciated.