I have the following incoming data:
Date | Data | ID |
---|---|---|
03/21 | Red: 10 | 01 |
03/21 | Blue: 5 | 02 |
04/21 | Red: 20, Blue: 15 | 03 |
04/21 | Green: 7 | 04 |
04/21 | Red: 13, Green: 15 | 05 |
I have managed to separate the data into its components as shown below:
Date | Data | ID | Color 1 | Value 1 | Color 2 | Value 2 |
---|---|---|---|---|---|---|
03/21 | Red: 10 | 01 | Red | 10 | ||
03/21 | Blue: 5 | 02 | Blue | 5 | ||
04/21 | Red: 20, Blue: 15 | 03 | Red | 20 | Blue | 15 |
04/21 | Green: 7 | 04 | Green | 7 | ||
04/21 | Red: 13, Green: 15 | 05 | Red | 13 | Green | 15 |
I want to create a function that looks at each month and sums the values for each color. An example is below:
Date | Red | Blue | Green |
---|---|---|---|
03/21 | 10 | 5 | 0 |
04/21 | 13 | 0 | 22 |
I have absolutely no control over the incoming data. Any help would be greatly appreciated.