How about
Formula: copy to clipboard
=COUNTIFS(C:C,C2,A:A,"<"&A2)+1