# How do I find the first and last matches in a dataset? [closed]

Suppose I have the following data set...

_ A B

1 1 9

2 2 10

3 3 11

4 2 11

5 3 12

6 3 13

(Column A is the team number and column B is the age of the kid).
Suppose I want to know the youngest kid on team 2. I figured out the first match. I can say,

=INDEX(B$1:B$5,MATCH(2,A$1:A$5,0),1)

...and it would tell me that the youngest kid on team 2 is 10yrs old. How would I find the oldest member of a team? I want to say, how old is the oldest kid on team 2 and have it respond "11", or how old is the oldest kid on team 3 and have it respond "13".

Thanks!