Really annoying multi-column averaging problem

mrdrumhead

New Member
Joined
Nov 13, 2012
Messages
2
Hi folks, so this problem is probably pretty elementary to some, but...
Column A has numbers to average. Column B has frequency of occurrence of each number in column A. The brute force option would be to manually enter in a new column each value in A however many times as defined in B, that way you would have the correct average, but this would take far too long. Anyone have an idea of how to do this?
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Numbers to Average[/TD]
[TD]Frequency of Each Number to Average[/TD]
[/TR]
[TR]
[TD]3203[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]3170[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]3122[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]







etc. etc. for hundreds and hundreds of rows
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi folks, so this problem is probably pretty elementary to some, but...
Column A has numbers to average. Column B has frequency of occurrence of each number in column A. The brute force option would be to manually enter in a new column each value in A however many times as defined in B, that way you would have the correct average, but this would take far too long. Anyone have an idea of how to do this?
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Numbers to Average[/TD]
[TD]Frequency of Each Number to Average[/TD]
[/TR]
[TR]
[TD]3203[/TD]
[TD]37[/TD]
[/TR]
[TR]
[TD]3170[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]3122[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]







etc. etc. for hundreds and hundreds of rows
If column A contains the individual numbers you want to average and B the number of times that number appears, then just use sumproduct(A:A,B:B)/sum(B:B) to get the average.
 
Upvote 0
If column A contains the individual numbers you want to average and B the number of times that number appears, then just use sumproduct(A:A,B:B)/sum(B:B) to get the average.

Thanks for your answer! I didn't quite understand what's actually happening in the equation though, so I did a manual average test case and it actually came out a little different...
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]173[/TD]
[TD]29[/TD]
[/TR]
[TR]
[TD]2405[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]3066[/TD]
[TD]11[/TD]
[/TR]
</tbody>[/TABLE]
What happens is the formula you listed gives me an output of 1329.509, but when I manually list out each occurence and just AVERAGE for that column, it gives me 1340.981. Any idea why this might be happening?
 
Upvote 0
Thanks for your answer! I didn't quite understand what's actually happening in the equation though, so I did a manual average test case and it actually came out a little different...
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]173
[/TD]
[TD]29
[/TD]
[/TR]
[TR]
[TD]2405
[/TD]
[TD]14
[/TD]
[/TR]
[TR]
[TD]3066
[/TD]
[TD]11
[/TD]
[/TR]
</tbody>[/TABLE]
What happens is the formula you listed gives me an output of 1329.509, but when I manually list out each occurence and just AVERAGE for that column, it gives me 1340.981. Any idea why this might be happening?


Both formulas

=SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4)

=SUMPRODUCT(A:A,B:B)/SUM(B:B)

yield 1340.981 for the last sample, as they should.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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