How to Fix #NUM! Error in Excel MEDIAN IF Formula
Question details
The user needs to calculate a conditional median using multiple criteria (text strings, Yes values, country codes), but applying a wildcard with an equals sign results in a #NUM! error.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating a median value based on multiple conditions where one of the text criteria requires wildcard-style partial matching.
- Observed behavior
- The MEDIAN IF formula returns a #NUM! error because standard equals comparisons in these formulas do not support wildcard characters like the asterisk (*).
Verify your version of Excel to determine if you can use the modern FILTER function or if you must rely on traditional array formulas. Additionally, replace full column references with specific bounded ranges to prevent performance drops.
Use the MEDIAN and FILTER Functions (Microsoft 365)
For newer spreadsheet versions, use the FILTER function combined with the LEFT function to handle partial text matches without using wildcards.
The asterisk (*) does not act as a wildcard when paired with a standard equals comparison. Instead of relying on wildcards, you can use the LEFT function to match the exact number of characters at the beginning of the text string.
Click on the blank cell where you want the conditional median result to appear.
Type the formula: =MEDIAN(FILTER(X:X,(LEFT(AG:AG,17)="Central Functions")*(Y:Y="Yes")*(F:F="UK"),"")) into the formula bar.
For better calculation speed, change the full column references (like X:X) to specific ranges (like X2:X1000) for all variables in the formula.
Press Enter to apply the formula and retrieve the correct median value based on your complex criteria.

Use a Nested IF Array Formula (Older Versions)
If you are using an older version of Excel that lacks the FILTER function, you can use a traditional nested IF array formula.
Calculate Conditional Medians Effortlessly with WPS Spreadsheet
WPS Spreadsheet fully supports dynamic arrays and advanced functions like MEDIAN, FILTER, and LEFT, making it easy to perform complex data analysis without dealing with frustrating formula syntax errors.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the file containing your conditional data.
- 2. Input the advanced formula: Select an empty cell and type the =MEDIAN(FILTER(...)) formula, ensuring you adjust the specific data ranges.
- 3. Instantly view results: Press Enter. WPS Spreadsheet's powerful calculation engine will instantly process the multiple criteria and output the correct median.

Frequently Asked Questions
Why does my MEDIAN IF formula return a #NUM! error?
A #NUM! error in a MEDIAN formula often occurs when the function encounters invalid calculations or empty arrays. In conditional formulas, this typically happens when an invalid criteria format is used (like an unsupported wildcard) leading to zero matched results.
Can I use wildcards with an equals sign in Excel formulas?
No, standard equals comparisons (=) in array formulas do not recognize wildcard characters like asterisks (*). To match partial text, you must use specific text functions like LEFT, RIGHT, or SEARCH.
Why should I avoid full column references like X:X in array formulas?
Array formulas evaluate every single cell in a defined range. Using full column references forces the software to calculate over one million rows per array condition, which can severely slow down performance or cause the application to freeze.




