'Count values as per required pattern in excel

enter image description here

User ID - 39 is repeated but there are different incentive plans for 39. I want the result as shown in desired output.



Solution 1:[1]

With Excel-365 can try-

=SUM(--(UNIQUE(FILTER($B$2:$B2,$A$2:$A2=A2))<>""))

enter image description here

Solution 2:[2]

It looks like your data is sorted by User ID and Incentive Plan. In that case you may benefit from IF and logical thinking:

enter image description here

=IF(A2<>A1;1;IF(B2=B1;C1;C1+1))

Please, notice this formula will work only if your data is sorted like the one in your image. If you change this order, the formula won't work properly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Harun24hr
Solution 2