I'm glad it helped.
If you say that the table in Sheet2 may not have XP values in ascending order, you may use, for ex.:
=SUMPRODUCT((Sheet2!$A$2:$A$13=B2)*(Sheet2!$B$2:$B$13=AGGREGATE(14,6,Sheet2!$B$2:$B$13/(Sheet2!$A$2:$A$13=B2)/(C2>=Sheet2!$B$2:$B$13),1)),Sheet2!$C$2:$C$13)
Bookmarks