VBA code for AVERAGEIF

Lester07

New Member
Joined
Aug 4, 2009
Messages
29
Hello guys, I'm working with Excel 2003 and I desperately need the AVERAGEIF function. Can you give a user defined function for AVERAGEIF... Thanks in advance
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Posting a Sample Worksheet of data with expected UDF result(s) would be helpful
 
Upvote 0
Hey Jim thanks for the response. I'm working with Excel 2003 and as far as I know, AVERAGEIF is only available in 2007. hope this example helps... Thanks..

Excel Workbook
ABCDE
1XXXScoreRepXXX
2Rep1XXXXXX91.25%
3Rep195.00%Rep270.00%
4Rep170.00%Rep280.00%
5Rep1100.00%
6Rep280.00%XXXXXX
7Rep20.00%
8Rep2XXXXXX
9XXX100.00%XXXXXX
10XXX100.00%
11XXX50.00%
12Rep375.00%XXXXXX
13Rep395.00%
Sheet1
 
Upvote 0
Couldn't you just use a pivot table?
 
Upvote 0
And a pivot table won't do that?:)
 
Upvote 0
Probably a Better way but try:

=SUMPRODUCT(--($A$2:$A$13=D2),--(ISNUMBER($B$2:$B$13)),$B$2:$B$13)/COUNTIF($A$2:$A$13,D2)
 
Upvote 0
Care to explain those XXX's for it seems an XXX stands for a rep, a score, and even for a header as displayed in A1 of your exhibit? Are the values in D:E desired calculations?
 
Upvote 0
Lester, It's better to post the corrected Sheet data again, versus using your Text edit technique.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

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