In Excel, I can apply sequential numbers within each group of values.
For example - Column A has groups of values which Column B applies sequence numbers to the members of each group.

The number sequence in Column B is generated by COUNTIF($A$2:A2,A2) which is copied in every cell in the column.
I see that Anaplan's answer to COUNTIF is to combine an IF THEN statement with the SUM function. How can this combination be used to create the grouped numbered sequence?
Thanks - Guy