Add and count
Average numbers that meet a condition
=AVERAGEIF(A2:A5,E2,B2:B5)How it works in Excel
- A2:A5 is the column Excel checks.
- E2 is what it looks for.
- B2:B5 holds the numbers to average.
- Blank cells in the number column are ignored.
- If nothing matches you get a #DIV/0! error. Wrap it in IFERROR to show something else.
- For several conditions, use AVERAGEIFS.
The idea in general
Take only the rows you care about, add them up, and divide by how many there are.
What I assumed
- The categories are in A2:A5, the numbers are in B2:B5, and the category you want is in E2.
Check the result on your own data before relying on it.