Formula Errors

How to Fix #NUM! Error in Excel MEDIAN IF Formula

Tauseeq MagsiTauseeq Magsi Nov 11, 2026 869 views

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.

How to Fix #NUM! Error in an Excel MEDIAN IF Formula
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 (*).
Before you start

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.

Solution 1Recommended

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.

1
Select the destination cell

Click on the blank cell where you want the conditional median result to appear.

2
Enter the FILTER formula

Type the formula: =MEDIAN(FILTER(X:X,(LEFT(AG:AG,17)="Central Functions")*(Y:Y="Yes")*(F:F="UK"),"")) into the formula bar.

3
Adjust to bounded ranges

For better calculation speed, change the full column references (like X:X) to specific ranges (like X2:X1000) for all variables in the formula.

4
Execute the calculation

Press Enter to apply the formula and retrieve the correct median value based on your complex criteria.

Use the MEDIAN and FILTER Functions (Microsoft 365)
Why this works: The FILTER function processes multiple conditions cleanly, while LEFT extracts the specific prefix needed, completely bypassing the limitation of wildcard characters.
Advanced Formula Support

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. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the file containing your conditional data.
  2. 2. Input the advanced formula: Select an empty cell and type the =MEDIAN(FILTER(...)) formula, ensuring you adjust the specific data ranges.
  3. 3. Instantly view results: Press Enter. WPS Spreadsheet's powerful calculation engine will instantly process the multiple criteria and output the correct median.
100% compatible with Microsoft Excel formulas and nested arraysNative support for dynamic array functions like FILTERLightweight architecture ensuring smooth performance even with large datasets
microsoft office alternative - wps office

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.