Take the Median of a Dataset with Multiple Criteria

novaquasar

New Member
Joined
Jul 26, 2023
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
I'm struggling to take a median of a set of data with multiple criteria

I have a set of raw data (Shown Below)
ExampleData.PNG

I want to find the Median of the data in Row K (Gain) for all the cells where the DEF Call (Row H) is "Base Tommy" AND it's in Hole (Row R) 2 OR 3 OR 4 OR 5. (I don't want the median to include any other values of Row K where those criteria aren't met, i.e. Hole 7 or 8, Def Call "Arrow 4", )

Hypothetically, I want to be able to add new data to this worksheet and have Excel auto calculate the Median for all the data, including the new data, as long as it meets those criteria.

I've tried using Median(If( and Boolean logic but I'm admittedly stumped... Is there anyway for Excel to auto-calculate this for me (without needing to manually filter data and aggregating it? If so, how would I do this?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
For future reference, it's better if you help those trying to help you by providing a sample of your data using the XL2BB add in, or alternatively making a copy of your file available via Dropbox, Google Sheets or similar file sharing platform - that way helpers aren't forced to type out your data to test various potential solutions. Does the following give you what you want (array formula entered with Ctrl+Shift+Enter)

Book1
FGHIJKLMNOPQR
1DEF CALLGAINHOLE
21Arrow 442
3Base Trump52
4Base Tommy13
5Base Trump13
6Leo 433
7Base Tommy53
8Base Trump83
9Base Trump83
10Base Tommy-14
11Base Trump14
12Edge Auto34
13Base Trump26
14Base Tommy36
15Edge Auto66
16Base Trump37
Sheet1
Cell Formulas
RangeFormula
F2F2=MEDIAN(IF((H2:H16="Base Tommy")*(R2:R16>=2)*(R2:R16<=5),K2:K16))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Another option
Excel Formula:
=MEDIAN(FILTER(K2:K100,(H2:H100="Base Tommy")*(R2:R100>=2)*(R2:R100<=5)))
 
Upvote 0
For future reference, it's better if you help those trying to help you by providing a sample of your data using the XL2BB add in, or alternatively making a copy of your file available via Dropbox, Google Sheets or similar file sharing platform - that way helpers aren't forced to type out your data to test various potential solutions. Does the following give you what you want (array formula entered with Ctrl+Shift+Enter)

Book1
FGHIJKLMNOPQR
1DEF CALLGAINHOLE
21Arrow 442
3Base Trump52
4Base Tommy13
5Base Trump13
6Leo 433
7Base Tommy53
8Base Trump83
9Base Trump83
10Base Tommy-14
11Base Trump14
12Edge Auto34
13Base Trump26
14Base Tommy36
15Edge Auto66
16Base Trump37
Sheet1
Cell Formulas
RangeFormula
F2F2=MEDIAN(IF((H2:H16="Base Tommy")*(R2:R16>=2)*(R2:R16<=5),K2:K16))
Press CTRL+SHIFT+ENTER to enter array formulas.
This worked, thanks!

Is there a reason why Excel seems to prefer array functions for boolean logic rather than just letting me hit enter?
 
Upvote 0
This worked, thanks!

Is there a reason why Excel seems to prefer array functions for boolean logic rather than just letting me hit enter?
Not necessarily boolean logic - a simple IF() function is as boolean as you can get, but doesn't require entering as an array...
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,107
Members
453,021
Latest member
Justyna P

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