I've tried the formula below and it does not work, guessing I don't have it written correctly:

=AVERAGE(IF(A1:A6="A",IF(B2:B6="123",C2:C6))), using Crtl+Shift+Enter, it returns an error.