I cant give you a single formula that will do this, as there is more than one thing you need to do to find and count the "draws ago" of the pair in your results list. First the pair have to be identified where they occur together in your table of results and marked. Secondly having found this, the row where the last occurrence of the pair happens needs to be extracted and shown.
It is easier and more useful, in my opinion to first mark ( in another column) where the pairs are found and identify the row with the word "FOUND".
The formula to do this is :- In cell K2 enter the formula :- =IF(AND(IF(ISNA(MATCH($N$2,D2:J2,0)),0,1),IF(ISNA(MATCH($N$3,D2:J2,0)),0,1)),"FOUND",""). Copy this formula down column K as far as your results list goes.
Then to show where the last ocurrence was (the draws ago) you need to count how far down the list the first occurence of the word "FOUND" appears. This formula entered in cell N4 :- =INDEX(MATCH("FOUND",K2:K10000,0),0) will do that job.
Note that your counter numbers in columns A and B are not being used by any formula. The above formula just counts how far down your table the first pair found is.
Because you have a marker on the correct row, you could if you wished use conditional formatting to highlight the two numbers concerned. In Microsoft 365 this is how I do it ( I must admit its a bit unforgiving even for the experienced)
Click on any cell in the results
Home>conditional formatting> manage rules> new rule> use a formula to determine which
cells.
in the box "Format values where this formula is true":-
paste in this formula :- =AND(OR(D2=$N$2,D2=$N$3),$K2="FOUND")
click format, set the fill colour , click Ok.
In the next dialog click Ok then in the "Applies to" box, delete any contents and replace with =$D$2:$J$2000 ( the 2000 is just to cover all your possible rows, could be more or less)
Click Apply
Click OK to finish.
Fingers crossed that works ...🙏
Please let me know how you get on. 🙂