Hi,
I have the below Table:
Name5Name2Name2Name1Name3Name2Name2Name2Name2Name5Name3Name3Name2Name2Name2
I want to get the Name2 continuous count, and accumulated count as explained below:
For example: Name2 run continuously three times (2(row2&row3), 4(row6~9), 3(row13~15)), its max is 4, and its accumulated continuous run is 9(2+4+3). Output1:
243
output2:
Name5 -1Name2 1Name2 2Name1 -1Name3 -2Name2 1Name2 2Name2 3Name2 4Name5 -1Name3 -2Name3 -3Name2 1Name2 2Name2 3
Output2 explanation:
Consider Name2 as 1, and if it is continuous the number increase like 1,2,3 …(till change from Name2 to other) and except Name2, all other weighting given as -1(it increases like -1,-2,-3,-4 etc till Name2 appear). For instance, row1 is Name5(it is -1), row 2&3 are Name2 (1,2), row4&5 Name1&Name3 (-1,-2), row 6~9 Name2(1,2,3,4) etc. My purpose is when Name2 change to other it is given -1 and till it changes to Name2 again (Name2 given as 1 and increase if it is continuous).
Best Answer