Try this, entered as an array formula by holding down ctrl+shift while you hit Enter

=MEDIAN(IF($B$1:$B$10={"A","C"},$A$1:$A$10))

The IF function returns an array of either the appropriate value in A1:A10, or FALSE. And the MEDIAN function will ignore the logical values, since they are produced by a function, and not manually entered.

Here is a screen shot showing the data and the result. You can see the formula in the formula bar: (Note that the braces {...} around the formula are NOT added manually. They will be added by Excel when you confirm the formula with ctrl+shift+enter. With regard to the array constant, however, those braces you do type in manually.

Answer from Ron Rosenfeld on Stack Overflow
🌐
Microsoft Support
support.microsoft.com › en-us › office › median-function-d0916313-4753-414c-8537-ce85bdd967d2
MEDIAN function - Microsoft Support
Arguments that are error values or text that cannot be translated into numbers cause errors. Note: The MEDIAN function measures central tendency, which is the location of the center of a group of numbers in a statistical distribution.
🌐
Excel Forum
excelforum.com › excel-formulas-and-functions › 1207681-median-if-formula-not-working.html
Median if formula not working [SOLVED]
I can't figure out what's wrong with my median if formula--this is what I'm using: {=MEDIAN(IF('Hours per Client'!$I$2:$I$608=A2,'Hours per Client'!$E$2:$E$608))} (the curvy brackets representing ctrl-shift-enter) but it keeps returning "N/A": median if.png I tried changing the formula to {=MEDIAN(IF('Hours per Client'!$I:$I=A2,'Hours per Client'!$E:$E))} but that didn't work either: median if 2.png What am I doing wrong? ... Evaluate the formula, you will find error. In my knowledge, syntax of median formula is =median(number1,number2,...) The result of inner formula should be in number.
🌐
Microsoft Community
techcommunity.microsoft.com › microsoft community hub › communities › products › microsoft 365 › excel
I'm having trouble creating a MEDIAN(IF(AND function in excel. | Microsoft Community Hub
However, as soon as I change it to MEDIAN(IF(AND( the function returns 0. I tried Control + Shift + Enter, but it still does not work. I have provided an example below. The formula for cell D1 is =MEDIAN(IF(B2:B9="a",C2:C9)), which returns the correct Median for the list. The formula for cell D3 is =MEDIAN(IF(AND(B2:B9="a",A2:A9=6),C2:C9)), which returns the incorrect Median for the list. excel ·
🌐
Reddit
reddit.com › r/excel › the median function is giving me the wrong answer. what am i doing wrong here?
r/excel on Reddit: The median function is giving me the wrong answer. What am I doing wrong here?
September 6, 2019 -

I’m using a dataset with thousands of information on it. After filtering the dataset, only 8 rows of data is shown. I used the simple formula "=MEDIAN(i300:i1400)" but it did not give me the median of the 8 visible cells. I calculated it myself to be certain. Is it possible that instead of just using the 8 visible rows, it calculated the entire original data set between those cell numbers (i300 and i1400)?

ETA: I decided to try =ROW(i300:i1400) to see if it would reference the correct amount of rows and it didn't. It gave me 1100 when I want it to give me 8 because thats how many visible rows there are. Hopefully that makes more sense.

Between I300 and I400 there are 8 visible cells (after filtering it) that I want the median of. I do not want the median of 1100 cell numbers from the unfiltered data.

🌐
Microsoft Support
support.microsoft.com › en-us › office › calculate-the-median-of-a-group-of-numbers-2e3ec1aa-5046-4b4b-bfc4-4266ecf39bf9
Calculate the median of a group of numbers - Microsoft Support
Note: Do not select the row or column headers. ... Press CTRL+C. In the worksheet, select cell A1, and press CTRL+V. Select inside an empty cell. Select the Formula tab, and then select AutoSum > More functions. Type MEDIAN in the Search for a function: box, and then select OK.
🌐
DataCamp
datacamp.com › tutorial › how-to-find-median-in-excel
How to Find Median in Excel: The Easy Way and the Long Way | DataCamp
July 16, 2025 - However, if you type text directly into the formula (like =MEDIAN("apple", 10)), Excel will return a #VALUE! error, so don’t do this. Logical values (TRUE, FALSE): If included as part of a range, they’re ignored. If you type them directly as arguments, TRUE counts as 1 and FALSE as 0. You could find the median without the MEDIAN() function. I’ll show you how, if you’re curious, but I don’t recommend it because, as you will see, it’s too much work.
Find elsewhere
🌐
Ablebits
ablebits.com › ablebits blog › excel › excel formulas › median formula in excel - practical examples
MEDIAN formula in Excel - practical examples
March 20, 2023 - Regrettably, Microsoft Excel does not provide any special function to calculate a median based on a condition like it does for the arithmetic mean (AVERAGEIF and AVERAGEIFS functions).
🌐
W3Schools
w3schools.com › excel › excel_median.php
Excel MEDIAN Function
You can learn about median in our Statistics Median Tutorial. Calculating the median manually requires that the data is sorted and arranged from low to high. This is not necessary using the MEDIAN function, it does it for you. ... Great! You successfully found the median using the =MEDIAN function.
🌐
EDUCBA
educba.com › home › excel › excel resources › statistical functions in excel › excel median function
Median Function in Excel (Formula, Examples) | How to use Median?
August 23, 2023 - In current versions of Excel (Excel 2007 and later), the function can only accept up to 30 number arguments, but you can provide up to 255 number arguments to the Mode function in Excel 2003. Cells with zero values (0) are added to calculations. This has been a guide to Median Function in Excel.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
ExtendOffice
extendoffice.com › documents › excel › how to median values ignore zeros or errors in excel?
How to median values ignore zeros or errors in Excel?
Make sure there is at least one non-zero numerical value in the range, otherwise the formula will return a #NUM! error. This solution is ideal for cleaning up survey responses, expense reports, or sales data where zeros should be excluded from the analysis. Error values such as #N/A, #DIV/0!, ...
🌐
Association for Institutional Research
airweb.org › article › 2019 › 10 › 15 › excel-median-if-array-formula
Excel MEDIAN IF Array Formula | AIR
When the condition is met, the array formula determines what data the MEDIAN function will examine to find the middle award amount. To complete an array formula, type the formula (minus the curly brackets), then press Control, Shift, and Enter at the same time. This will finalize the array formula in Excel and insert the curly brackets at the beginning and end of the formula. Do not type the curly brackets in the formula.
🌐
Reddit
reddit.com › r/excel › median(filter function not working?
r/excel on Reddit: MEDIAN(FILTER function not working?
October 19, 2022 -

Here's what I'm trying to do. I have two columns in Sheet 1: 1) whether they are First-Gen or not (#N/A) based on an XLOOKUP to a hidden sheet, and 2) a column that displays salary.

In Sheet 2, I'm trying to calculate =MEDIAN(FILTER('Sheet 1'!$Y:$Y,'Sheet 1'!$O:$O="First-Gen")) but it calculates #N/A even though there are salaries for some First-Gen individuals. When I use this same written format for other columns with other categories, it works just fine. I don't get it.

For example, I have something similar for "Male" in column F on Sheet 1, and the formula calculates fine in Sheet 2 when it is written: =MEDIAN(FILTER('Sheet 1'!$Y:$Y,'Sheet 1'!$F:$F="Male"))

Any assistance would be greatly appreciated.

🌐
Reddit
reddit.com › r/excel › functional equivalent to medianif?
r/excel on Reddit: Functional equivalent to MEDIANIF?
April 9, 2019 -

I've used AVERAGEIF to work out the mean age of women (as opposed to men) in a dataset. I'd like to do something similar with the median.

There is no MEDIANIF function in Excel and I'd like to work out the median age of females ("F" in the gender column) in my sample. It was easy to work out the mean with AVERAGEIF but there is no MEDIANIF.

Is there a way of doing that?

🌐
SpreadsheetWeb
spreadsheetweb.com › home › how to calculate median function in excel with formula examples
How to Calculate MEDIAN Function in Excel with Formula Examples
January 4, 2024 - It's also important to ensure that the data being used is appropriate for median calculation and not better suited for other statistical methods. Paying close attention to these details can help you quickly identify and rectify the source of the #DIV/0! or #VALUE! errors, ensuring accurate and reliable median calculations in Excel. Using the MEDIAN function in Excel can greatly enhance your data analysis, but there are key tips to keep in mind for optimal results.
🌐
LiveFlow
liveflow.com › product-guides › how-to-use-median-function-in-excel
How to Use MEDIAN Function in Excel
Step 2: Select the values one after the other by separating them using “,” (commas). You can also select arrays of data as shown in the image below, where you are calculating the median of the prices charged in the months of June and July. ... NOTE: The MEDIAN formula takes into account zeros in the selected data set.