=AVERAGE(IF(rng=some_condition,rng))
which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.
Excel will automatically enclose the formula in braces (curly brackets), do
not try to do this manually.
When editing the formula, it must again be array-entered.
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)