Counting and averaging with a mix of IF and OR

bluesky6688

New Member
Joined
Dec 24, 2013
Messages
34
Good evening~

I am trying to analyze some experimental data I recently collected. I need some complicated formula but I am not an advanced Excel user. Any help is greatly appreciated.

So, below is a simplified data set with 3 formula I am trying to create:

1A(ID)BCD
2aILL23
3aPLL34
4aILL55
5aILL26
6bILL5
7cPLL3
8cILL2
9dPLL3
10eILL35

<tbody>
</tbody>

Calculation
Formula A (FA): to calculate the average all cells in D that satisfy: (B2:B10="IL")+(C2:C10="L2" or C2:C10="L3)+ISNUMBER(D2:D10).
Result: mean = 4.67 (3,6,5)

FB: Count all number of cells in D that used to calculate the average above.
N = 3 (3, 6, 5)

FC: Count all non blank cells in column D that satisfy these criteria: (B2:B10="IL") + (C2:C10="L2" or "L3") + (unique value in A2:A10).
n = 2 (a,e)

I made FA ={AVERAGE(IF(OR(C2:C10=A12,C2:C10=B12),IF(B2:B10=D21,IF(ISNUMBER(D2:D10),D2:D10))))}. The result is wrong 4.75, which is the average of (3,5,6,5), and is not what I expect (average of 3,6,5).

I will also need to calculate STDEV, I assume that will be similar with average.

Thanks again!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
try something like this
edit: if you want to list them say in Column I4
array also
=INDEX($A$2:$A$10,MATCH(0,IF($D$2:$D$10<>0,COUNTIF($I$3:I3,$A$2:$A$10)),0))

Hi vlady,

I am interested in this formula but it only listed one value in the cell where the formula is. I3 is still empty (I assume the values should be listed vertically). Can you check why? I hope I could figure it out by myself but I am not there yet.

Thank you!
 
Upvote 0
Hi vlady,

I am interested in this formula but it only listed one value in the cell where the formula is. I3 is still empty (I assume the values should be listed vertically). Can you check why? I hope I could figure it out by myself but I am not there yet.

Thank you!

F2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$10,SMALL(IF(FREQUENCY(IF($A$2:$A$10<>"",
  IF(ISNUMBER($D$2:$D$10),MATCH($A$2:$A$10,$A$2:$A$10,0))),
  ROW($A$2:$A$10)-ROW($A$2)+1),ROW($A$2:$A$10)-ROW($A$2)+1),
  ROWS(F$2:F2))),"")

Note that this test whether the D-range has a number, not any value.
 
Upvote 0
F2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$10,SMALL(IF(FREQUENCY(IF($A$2:$A$10<>"",
  IF(ISNUMBER($D$2:$D$10),MATCH($A$2:$A$10,$A$2:$A$10,0))),
  ROW($A$2:$A$10)-ROW($A$2)+1),ROW($A$2:$A$10)-ROW($A$2)+1),
  ROWS(F$2:F2))),"")

Note that this test whether the D-range has a number, not any value.[/QUOTE

Got it. Thank you! What I missed is copying down. I thought Excel will automatically list all the values:)
 
Upvote 0
F2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$10,SMALL(IF(FREQUENCY(IF($A$2:$A$10<>"",
  IF(ISNUMBER($D$2:$D$10),MATCH($A$2:$A$10,$A$2:$A$10,0))),
  ROW($A$2:$A$10)-ROW($A$2)+1),ROW($A$2:$A$10)-ROW($A$2)+1),
  ROWS(F$2:F2))),"")

Note that this test whether the D-range has a number, not any value.

Got it. Thank you! What I missed is copying down. I thought Excel will automatically list all the values:)

You are welcome.
 
Upvote 0

Forum statistics

Threads
1,216,025
Messages
6,128,356
Members
449,444
Latest member
abitrandom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top