=A2-MAXIFS(Data!A2:A10;Data!B2:B10;Summary!B2)
Maybe this will work