How calc median, average, max based on condition? Like SUMIF kinda...

somanyqs

Board Regular
Joined
Oct 2, 2007
Messages
76
Say I want to know the average weight of our apples, and the data I have looks like this:

Col A Col B

Food Weight (oz)
Apple 6
Banana 12
Apple 9
Apple 5
Banana 11


Is there something like a SUMIF function to calculate the Average, Median and Max for the weight of the apples?

I know for average I could do SUMIF/COUNTIF to get the average, but didn't know if there was an easier way.
Also not sure how to do it at all for Median and Max...


Thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
=AVERAGE(IF(B1:B100>50,A1:A100))

Ctrl+Shift+Enter to confirm.

Will return the average of A1:A100, but only for those rows where B1:B100 is greater than fifty.
 
Upvote 0
=AVERAGE(IF(A2:A6="apple",B2:B6))
=MEDIAN(IF(A2:A6="apple",B2:B6))
=MAX(IF(A2:A6="apple",B2:B6))

all need to be confirmed with CTRL-SHIFT-ENTER rather than just Enter.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,716
Members
449,093
Latest member
Mnur

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