Converting my "AverageIf" to "MedianIf" for Google sheets

Dustinkli

Board Regular
Joined
Mar 26, 2019
Messages
62
Office Version
  1. 365
  2. 2011
Platform
  1. Windows
I have a formula which looks at the average of a column based on 2 criteria:

Excel Formula:
=IFERROR(AVERAGEIF(Sheet1!$D:$D,$A4,INDEX(Sheet1!$A:$BR,0,MATCH(E$1,Sheet1!$A$1:$BR$1,0))))

which looks at 2 variables and then looks up the matching column and rows on another sheet to get the average.

I would like to instead get the Median because there are occasionally deviations that are so huge they throw the average off and make it useless.

I have the following formula working, but it's very very clunky:

Excel Formula:
=Median(Index(QUERY(Sheet1!$A:$BT,"select H, D where D = '"&$A4&"'",1),,1))

I'd like to either have a formula that works like the first one but pulls the median of the range, or have some way to remove the deviations that throw the average off.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Oh, You're correct. I'm using GoogleSheets. I tend to think they're interchangeable as far as the functions go but looks like this is one of those cases where it isn't.
 
Upvote 0
In future when asking questions about anything other than Excel you need to make it clear in your title & such questions should be posted in the General Discussion & Other Applications section of the board.

I have done that for you this time.
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,249
Members
449,093
Latest member
Vincent Khandagale

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