Based on my data, I want to find the median PRICE of top 10 IDs basis the ENR value in every county. In the attached file

I have already found the top 10 IDs basis the ENR value but cannot figure out how to find the median of these top 10 PRICE values in a county.
Any help is appreciated.
Thanks.