Formula to figure an average on a range of cells with an "if" form

L

lucyo912

I have a spreadsheet that has a formula in column g that is an "if" formula
for the data in column f. I need to get an average of the data in column
"g". For example

column f column g
yellow 2
green 3
red 1
red 1
red 1
average yellow need formula for this

help!
 
M

Mike H

Hi,

Try this

=AVERAGE(IF(F1:F20="Yellow",G1:G20,FALSE))

This is an ARRAY formula so commit the formula by pressing Ctrl+Shift+Enter
NOT just Enter. If you do it correctly Excel will put curly brackets around
it {}. You can't type these yourself.

Mike
 
L

Lars-Åke Aspelin

I have a spreadsheet that has a formula in column g that is an "if" formula
for the data in column f. I need to get an average of the data in column
"g". For example

column f column g
yellow 2
green 3
red 1
red 1
red 1
average yellow need formula for this

help!

Try this formula in cell G6:

=AVERAGEIF(F1:F5, "=yellow", G1:G5)

Hope this helps / Lars-Åke
 
L

lucyo912

nope - no dice - get the #DIV/0! error

Mike H said:
Hi,

Try this

=AVERAGE(IF(F1:F20="Yellow",G1:G20,FALSE))

This is an ARRAY formula so commit the formula by pressing Ctrl+Shift+Enter
NOT just Enter. If you do it correctly Excel will put curly brackets around
it {}. You can't type these yourself.

Mike
 
P

Peo Sjoblom

No need for the FALSE part in the formula, regardless this will return a div
error if there are no yellow in F1:F20
so make sure you don't have extra spaces etc in F1:F20 where it looks like
you have yellow

--


Regards,


Peo Sjoblom
 

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

Top