Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tim
 
Posts: n/a
Default average with if and AND statements

Hi,

This array formula =AVERAGE(IF(F2:F190=B5,K2:K190)) works great for one if
condition but Im trying to add one more AND statement to it like this:
IF(F2:F190=B5) AND G2:G190=B5 than average K2:K190. I changed the above to
the next array formula: =AVERAGE(IF(AND(F2:F190=A5,G2:G190=B5),K2:K190)) but
it doesnt work.
Does anybody know how to do this?

  #2   Report Post  
paul
 
Posts: n/a
Default

you only have one condition there,what happens if the average isnt equal to b5?
Any way this is what i would do,slightly different ranges,but
=IF(AND(AVERAGE(A1:A5)=A6,AVERAGE(C1:C5)=A6),AVERA GE(C1:C5),"averages NOT
eqaul A6")
--
paul
remove nospam for email addy!



"Tim" wrote:

Hi,

This array formula =AVERAGE(IF(F2:F190=B5,K2:K190)) works great for one if
condition but Im trying to add one more AND statement to it like this:
IF(F2:F190=B5) AND G2:G190=B5 than average K2:K190. I changed the above to
the next array formula: =AVERAGE(IF(AND(F2:F190=A5,G2:G190=B5),K2:K190)) but
it doesnt work.
Does anybody know how to do this?

  #3   Report Post  
Tim
 
Posts: n/a
Default

Thank you for your answer Paul!
Sorry I have made a mistake in my question.
Please read IF(F2:F190=A5) not IF(F2:F190=B5). So i need to get the
average in column K2:K190 only for the cells which corresponding(offset)
cells in Column F2:F190=A5 AND Column G2:G190=B5.



"paul" wrote:

you only have one condition there,what happens if the average isnt equal to b5?
Any way this is what i would do,slightly different ranges,but
=IF(AND(AVERAGE(A1:A5)=A6,AVERAGE(C1:C5)=A6),AVERA GE(C1:C5),"averages NOT
eqaul A6")
--
paul
remove nospam for email addy!



"Tim" wrote:

Hi,

This array formula =AVERAGE(IF(F2:F190=B5,K2:K190)) works great for one if
condition but Im trying to add one more AND statement to it like this:
IF(F2:F190=B5) AND G2:G190=B5 than average K2:K190. I changed the above to
the next array formula: =AVERAGE(IF(AND(F2:F190=A5,G2:G190=B5),K2:K190)) but
it doesnt work.
Does anybody know how to do this?

  #4   Report Post  
Max
 
Posts: n/a
Default

"Tim" wrote:
... average in column K2:K190 only for the cells which corresponding
cells in Column F2:F190=A5 AND Column G2:G190=B5 ..


Try, array-entered (CTRL+SHIFT+ENTER):
=AVERAGE(IF((F2:F190=A5)*(G2:G190=B5),K2:K190))
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--


  #5   Report Post  
Tim
 
Posts: n/a
Default

This one realy works.
Thank you Max!

Tim



"Max" wrote:

"Tim" wrote:
... average in column K2:K190 only for the cells which corresponding
cells in Column F2:F190=A5 AND Column G2:G190=B5 ..


Try, array-entered (CTRL+SHIFT+ENTER):
=AVERAGE(IF((F2:F190=A5)*(G2:G190=B5),K2:K190))
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--





  #6   Report Post  
Max
 
Posts: n/a
Default

You're welcome, Tim !
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--
"Tim" wrote in message
...
This one realy works.
Thank you Max!

Tim



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"