How to create a Sequence number based on Sales Agent name and sale date in excel using formula

56 views Asked by At

I am looking for a formula which can write the sequence no based on the criteria of Salesperson name and Sale order Date. below is the sample table. Please check if anyone can help me.

enter image description here

I tried using countif

=COUNTIFS(C$2:C2,"<="&C2,A$2:A2,A2)

but not getting the expected results as given in the image

2

There are 2 answers

1
Black cat On BEST ANSWER

This formula gives this result

=MATCH(B2,SORT(TOCOL(IF(A$2:A$8=A2,B$2:B$8,1/0),3),1,1),0)

enter image description here

0
VBasic2008 On

Running Count - Ascending

=LET(data,A2:B10,
    st,HSTACK(SEQUENCE(ROWS(data)),data),
    so,TAKE(SORT(st,{2;3}),,2),
    d,DROP(so,,1),
    s,d=VSTACK("",DROP(d,-1)),
    sc,SCAN(0,s,LAMBDA(sr,r,IF(r,sr+1,1))),
    r,SORTBY(sc,TAKE(so,,1)),
    r)

enter image description here