I have data set that shows below:
ID, Colour
1, Red
1, Yellow
1, Blue
1, Green
1, Pink
1, Red
1, Yellow
1, Blue
1, Red
1, Red
2, Red
2, Yellow
2, Blue
2, Blue
2, Yellow
2, Red
2, Blue
2, Red
2, Red
3, Blue
3, Blue
3, Red
3, Red
3, Yellow
3, Blue
3, Red
3, Yellow
3, Blue
I want to filter the row, which consists of this pattern of Red, Yellow, Blue.
The result should be like this, with the index of each pattern:
ID, Colour, Index
1, Red, 1
1, Yellow, 1
1, Blue, 1
1, Red, 2
1, Yellow, 2
1, Blue, 2
2, Red, 3
2, Yellow, 3
2, Blue, 3
3, Red, 4
3, Yellow, 4
3, Blue, 4
3, Red, 5
3, Yellow, 5
3, Blue, 5
Thank you in advance, hopefully, anyone can help.