If you need to get an average of a field during a query, but exclude a few groups you can use a case statement inside of an AVG call to eliminate those groups from the average.
All that you need to do is return a null for the value in the case statement. For example the following code will get you the average for the amount field except where the name is Bob or John.
WHEN name = 'Bob' THEN NULL
WHEN name = 'John' THEN Null
END) as average_amount