Assume your range is A1:B7

use this formula

=AVERAGE(IF(A1:A7=17,B1:B7))
Press ctrl+shift +enter after modification