Index, Match, Average using Active Cell

kipper19

Board Regular
Joined
Apr 12, 2014
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Hi all,
Wondering if someone would know if its possible to use the Average function with Index Match using my below Active Cell code, I use this code a lot in spreadsheets but it has me stumped on how to incorporate the Average function.
Basically what I want the code to do is look in column B for the number represented in Column E then average the figures in Column C against that particular number


VBA.png


Range("D" & Trim(Str(rr.Row))).Select
ActiveCell.FormulaArray = _
"=IFERROR(INDEX(Sheet1!R3C3:Sheet1!R" & Trim(Str(totAvg)) & "C3,MATCH(1,(Sheet1!R3C1:Sheet1!R" & Trim(Str(totAvg)) & "C1=Sheet1!R1C1)*(Sheet1!R3C5:Sheet1!R" & Trim(Str(totAvg)) & "C5=RC[-3]),0)),0)"
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
For example F3:
Excel Formula:
=SUMPRODUCT(--(($B$3:$B$11)=$E3),$C$3:$C$11/COUNTIF($B$3:$B$11,$E3))
 
Upvote 0
Flashbond,
Thanks for the reply, how would I also incorporate into this formula that A3:A11 = A1
 
Upvote 0
Like this?
Excel Formula:
=SUMPRODUCT(--(($A$3:$A$11)=$A$1)*--(($B$3:$B$11)=$E3),$C$3:$C$11)/COUNTIF($B$3:$B$11,$E3)
 
Upvote 0
Solution
By the way this could also be an alternative according to your needs:
Excel Formula:
=SUMPRODUCT(--(($A$3:$A$11)=$A$1)*--(($B$3:$B$11)=$E3),$C$3:$C$11)/COUNTIF($B$3:$B$11,$E3,$A$3:$A$11,$A$1)
 
Upvote 0

Forum statistics

Threads
1,215,090
Messages
6,123,061
Members
449,091
Latest member
ikke

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