Hi all, I need some help with my rank function.

I need to rank the value in BA4 against the values in BA4:BA4000

That part is easy enough, but I only want to rank the values in BA4:BA4000 where the value of AF4 is found in AF4:AF4000.

Basically a function that says rank value BA4 against values in BA4:BA4000 where the value in AF4 is also found in AF4000

Hope this is easy enough to understand?