'In Excel, how do I count how many time a value is associated with values in an adjacent column?

Greetings and salutations! I have a dataset as below. I need to count the number of times each unique Custom Id value is associated with a pair of Move to Thaw/Move to Freeze (known as freeze thaw cycles). For example, the first Custom ID of BS9583621 should have a count of 2, in fact all these in the example image should (but the list is very long and there will be hundreds with more or less than 2).

I tried something like this that I found online for a similar question someone else asked:

=IF(A2<>A1,COUNTIF(A:A,A2),"")

But it's essentially counting the number of times the Custom ID appears.

enter image description here



Sources

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

Source: Stack Overflow

Solution Source