Conditional Minimum and Maximum

Nintynuts

New Member
Joined
Nov 28, 2009
Messages
2
Hi :biggrin: , I use countIF, averageIF and sumIF a lot, and I want to do the same with Min and Max (also Mean and Median if possible), how would I do this? :confused:

Example:
Day Rating Month Year
1 5 Jan 2007
2 3 Jan 2007
3 4 Jan 2007
4 2 Jan 2007
1 1 Feb 2007
2 5 Feb 2007
3 5 Feb 2007

Minimum Rating for January is 2
Minimum Rating for 2007 is 1

The formula will be placed in line with the data and be sortable as with averageIF. (=averageIF(C:C,C1,B:B) would give me the average Rating for January, sorting this gives me months in order of the average rating)

(please note this is a contrived example to show what I mean, I don't really rate days :laugh:)
 
How about...

Excel Workbook
ABCDEF
1DayRatingMonthYear**
215Jan2007**
323Jan2007*2
434Jan2007*1
542Jan2007**
611Feb2007**
725Feb2007**
835Feb2007**
Sheet1
 
Upvote 0
You can use an "array formula" such as

=MAX(IF(C:C=C1,B:B))

confirmed with CTRL+SHIFT+ENTER

replace MAX with MIN or MEDIAN
 
Upvote 0
Ok, thanks, it works, but it takes about a minute to work it out on my quad core processor with my dataset. is there a more straight forward way for it to do it using the same processes as the afore mentioned functions (as they're instant)
 
Upvote 0
Don't use entire columns as range references if you don't have to. Use the smallest range that you can.

If your data is sorted or grouped together as is shown in your posted sample then use a formula like this:

F2 = some month like Jan

=MEDIAN(INDEX(Rating,MATCH(F2,Month,0)):INDEX(Rating,MATCH(F2,Month,0)+COUNTIF(Month,F2)-1))
 
Upvote 0

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