The MEDIAN function is one of the functions in Excel that helps you find the average value in a list of data.
In this case, the average is the middle or median value in the list.
The MEDIAN function can be combined with the IF function in an array formula to help you find the middle value for data that meets certain conditions.
How it works is:
The IF function lets you set conditions so that you can control what data is used by the formula.
An array formula lets you carry out multiple calculations in a single cell.
The MEDIAN function, as mentioned, finds the middle value - but only for only the data that meets the conditions set by you.
To find out all the details, read this tutorial on the Excel MEDIAN IF Array Formula.