The IF function lets you set conditions so that you can control what data is used by a formula.
An array formula lets you carry out multiple calculations in a single cell.
Put them all together and you have a single formula that will:
- check to see what data in a range meets the set condition
- for that data, the formula will find the smallest value
- or, the formula will find the smallest value in a second range of data
To find out all the details, read this tutorial on the Excel MIN IF Array Formula.