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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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