Average of Column B Bases on Column A

jennh

New Member
Joined
Mar 15, 2011
Messages
1
Oh dear...first of all, I apologize for not having an appropriate title as I don't know what words to use! But...here is my problem. I have a very large dataset with various columns, but I am only interested in two of them: "SampleID" and "Value". I would like Excel to search through the SampleID column and find cells with the same ID, then calculate the average of the "Value" column based on those search results, and return the results in another column.

For example, in the end I would like my spreadsheet to look like this (without the dots, of course):

SampleID.....Value.....AvgValue
351268........50
351268........75
351268........75.........100
362999........20
362999.........4..........12
375555.........60.........60

I hope I have been able to get my question across and I thank you in advance for reading this and trying to help.

Cheers :-)
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
One of...

1]

C2, control+shift+enter, not just enter, and copy down:
Code:
=AVERAGE(IF($A$2:$A$7=A2,$B$2:$B$7))

If on Excel 2007 or later...
Code:
=AVERAGEIF($A$2:$A$7,A2,$B$2:$B$7)

2] If you want to see the average at the last occurrence of a condition...

Control+shift+enter, not just enter, and copy down:
Code:
=IF(A2=LOOKUP(9.99999999999999E+307,1/($A$2:$A$7=A2),$A$2:$A$7),
    AVERAGE(IF($A$2:$A$7=A2,$B$2:$B$7)),"")
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,484
Members
452,917
Latest member
MrsMSalt

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