View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Average with conditions

"duane_mi" wrote:
I have the following formula
=AVERAGE(IF(D422:D427L422,H422:H427,"FALSE")*H422 :H427)


I cannot believe that formula works exactly as written. When one of
D422:D427 is not greater than L422, your IF expression returns the string
"FALSE", which you try to multiply. That will result in a #VALUE error.

Moreover, even if you correct that, your average will include zeros when
each of D422:D427 is not greater than L422. Normally, that is not what we
want. (You need to decide for yourself.)

So the formula should probably be written:

=AVERAGE(IF(D422:D427L422,H422:H427^2))

And if you use Excel 2007 or later, you can write:


"duane_mi" wrote:
The problem i have if that some of the cells in column H
have negative values and i cannot seem to ignore them.


Since you are squaring H422:H427, you do not really need to ignore negative
values. But if that is what you want, then:

=AVERAGE(IF(D422:D427L422,IF(H422:H4270,H422:H42 7^2)))