Average depending on criteria

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

Hi, I have a table similiar to this on Sheet1:

Col A ColB
2 Dog
5 Dog
3 Cat
8 Dog

On Sheet2, I want to calculate the average of the values in ColA where
ColB says Dog.

So sheet 2 would be:
Average
Dog 5
Cat 3


How can i do this?

Thank you!!
 
I use sumif/countif
=SUMIF(B2:B5,"Dog",A2:A5)/COUNTIF(B2:B5,"Dog")
=SUMIF(B2:B5,"Cat",A2:A5)/COUNTIF(B2:B5,"Cat")
 
=AVERAGE(IF(Sheet1!a2:A200="Dog",Sheet1!A2:A200))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Hi, I have a table similiar to this on Sheet1:

Col A ColB
2 Dog
5 Dog
3 Cat
8 Dog

On Sheet2, I want to calculate the average of the values in ColA where
ColB says Dog.

So sheet 2 would be:
Average
Dog 5
Cat 3


How can i do this?

Thank you!!

Just another thought -- you could use a Pivot Table.

With a cell in your table selected:

Data/Pivot Table

Then drag Col B to the Rows area
Col A to the Data area

Right click on the Data
Field Settings
Select Average of Column A

Format to taste -- there are many options.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top