Statistical FunctionsIntermediate

Pick the Cheapest Quote That Arrives in Time with MINIFS

The lowest price on a quote sheet is only a bargain if the part turns up when you need it. MINIFS finds the smallest value among the rows that pass every condition you give it, so you can ask for the cheapest quote from a supplier who can deliver in time.

Task:

You buy parts for a facilities team, and a boiler at one of your sites has failed. A2:D11 lists the quotes your suppliers have sent this week for several parts: the part, the supplier, the unit price and how many days they need to deliver. In G3, work out the cheapest price for the part named in G1 from a supplier who can deliver within the number of days in G2. In G4, work out the cheapest price for that part with no limit on delivery time. In G5, show how much extra the faster delivery costs. All three answers should update if someone changes the part in G1 or the days in G2.

Interactive Spreadsheet

Hints

+5 XPno-hints bonus

Solve it on your own to keep the bonus. Each hint gets one step closer to the formula.

The data in this exercise

This is the grid you start with. Cell references in the task — B6, C2 — point at the row numbers and column letters below.

11 rows × 7 columns3 cells you fill in
ABCDEFG
1PartSupplierUnit priceLead time (days)PartBoiler pump
2Boiler pumpHarlow Heating412.512Needed within (days)7
3Boiler pumpBrightwater Supply38921Cheapest in time
4Boiler pumpKestrel Parts4553Cheapest overall
5Boiler pumpNorthgate Trade438.757Cost of speed
6Expansion vesselHarlow Heating965
7Expansion vesselKestrel Parts88.42
8Boiler pumpRidgeway Plumbing471.21
9Expansion vesselNorthgate Trade79.914
10Thermostat valveBrightwater Supply23.154
11Thermostat valveKestrel Parts26.82
What this exercise teachesMay contain the answer

A quote sheet usually mixes several parts, so MIN(C2:C11) answers the wrong question: it returns 23.15, the price of a thermostat valve. Even filtered to boiler pumps, the lowest price is 389 from Brightwater Supply, and Brightwater needs 21 days, which is no use with a site out of heating. MINIFS solves both problems at once because it only considers rows that pass every condition. MINIFS(C2:C11,A2:A11,G1,D2:D11,"<="&G2) keeps the rows where the part is the one in G1 and the lead time is 7 days or fewer, which leaves Kestrel at 455, Northgate at 438.75 and Ridgeway at 471.20, and returns the smallest of them, 438.75. Northgate's 7 days counts because the test is less than or equal to. The condition has to be built as text, because MINIFS reads its criteria the way COUNTIF does: "<="&G2 joins the operator to the value in G2 and hands MINIFS the text <=7. Typing "<=G2" instead asks for lead times less than or equal to the word G2, nothing matches, and MINIFS returns 0, which looks like a free boiler pump rather than an error. That 0 is worth remembering: whenever no row qualifies, MINIFS returns 0, not #N/A. G4 drops the lead-time pair and returns 389, the cheapest pump regardless of delivery, and G5 subtracts one from the other: getting the pump within a week costs 49.75 more per unit. Because every condition points at a cell, tightening G2 to 2 days reprices the decision instantly to Ridgeway's 471.20, and changing G1 to Expansion vessel answers the same question for a different part.