1. Lighthouse

Level 6 · Biggest and smallest promo order with MAXIFS

The request

From Frank Bell, Account Executive

“For my business accounts' quarterly review: what was the biggest and the smallest completed web order they placed during the BFCM promo? Dates and status are at the top of the sheet. Cancelled orders don't count, they never shipped.”

Your goal

In G5, return the largest subtotal (D2:D59) among orders whose status (C2:C59) equals G3 and whose order_date (B2:B59) is between G1 and G2, both days included, with MAXIFS. In G6, the smallest one with MINIFS. Build the date criteria from G1 and G2 with &.

  • Fill G5:G6 with the right valuesnot done yet
  • With formulas, not typed numbersnot done yet
  • Use MAXIFS MINIFSnot done yet

Your sheet

Excel
The sheet for this level
ABCDEFGH
1order_idorder_datestatussubtotalPromo starts2025-11-28
2118302025-11-17completed58.96Promo ends2025-12-01
3118372025-11-17completed1226.84Statuscompleted
4118472025-11-17completed548.91
5118532025-11-18completed235.89Largest order
6118612025-11-18completed5216.96Smallest order
7118682025-11-18completed1442.94
8118742025-11-19completed365.88
9118782025-11-19completed2268.99
10118802025-11-19completed161.97
11118812025-11-19refunded2173.91
12118832025-11-19completed854.96
13118872025-11-19cancelled395.92
14119022025-11-20completed1846.00
15119362025-11-22completed1396.00
16119452025-11-22completed198.98
17119472025-11-22cancelled3943.86
18119572025-11-23completed3974.93
19119582025-11-23completed756.91
20119692025-11-23refunded1487.92
21119732025-11-23completed1021.84
22119782025-11-24cancelled1786.95
23119802025-11-24cancelled363.94
24119882025-11-24completed329.88
25119912025-11-24completed782.90
26119962025-11-24completed79.96
27120272025-11-26completed70.99
28120282025-11-26completed657.87
29120372025-11-27completed272.92
30120502025-11-27completed1070.89
31120622025-11-28completed339.86
32120732025-11-28completed227.95
33120822025-11-28completed100.48
34120852025-11-28completed1754.97
35120942025-11-28completed976.31
36121072025-11-28completed1062.81
37121242025-11-29completed338.23
38121262025-11-29completed72.71
39121412025-11-29completed572.23
40121612025-11-29completed2218.48
41121742025-11-30cancelled3149.12
42121802025-11-30completed1403.25
43121932025-11-30completed772.94
44122152025-11-30completed676.00
45122442025-12-01completed1722.71
46122672025-12-01cancelled393.96
47122892025-12-01completed583.98
48123002025-12-02completed149.94
49123222025-12-03completed462.83
50123412025-12-03completed480.96
51123472025-12-04completed259.96
52123812025-12-05completed1676.94
53123832025-12-05completed26.09
54124022025-12-06completed884.97
55124082025-12-06completed77.94
56124252025-12-07completed3476.00
57124452025-12-07completed113.92
58124602025-12-08completed759.97
59124652025-12-08completed359.97
60
61

Loading the editor…

    ResultPress Check to compare G5:G6

    Mote checks your result

    Press Check. Each right cell becomes a firefly in your lantern.

    The lesson

    SUMIFS adds up the matching rows and AVERAGEIFS averages them. Two more members of the family pick the extremes: MAXIFS returns the largest matching value and MINIFS the smallest. Combined with date criteria, they answer “what was our biggest order during the sale?” in one cell.

    MAXIFS and MINIFS

    =MAXIFS(max_range, range1, criteria1, range2, criteria2, …)
    =MINIFS(min_range, range1, criteria1, …)

    The argument order is the SUMIFS order: the range to search first, then the pairs. For the largest completed order on the whole sheet:

    =MAXIFS(D2:D59,C2:C59,"completed")

    That gives 5,216.96, an order from November 18, before the promo started. Frank wants the promo only, so the formula needs a date window.

    A date window from two cells

    Dates in a spreadsheet are numbers: each day is one more than the day before. That means the usual operators work on them. “From G1 to G2, both days included” is two conditions on the same column:

    B2:B59, ">="&G1,   B2:B59, "<="&G2

    As in level 4, the operator stays in quotes and the cell is joined with &. Typing a date inside the quotes, like ">=2025-11-28", can work, but how Excel reads typed dates depends on the computer’s regional settings. A date in a cell is the same everywhere.

    Put together, with the status in G3:

    G5   =MAXIFS(D2:D59,C2:C59,G3,B2:B59,">="&G1,B2:B59,"<="&G2)
    G6   =MINIFS(D2:D59,C2:C59,G3,B2:B59,">="&G1,B2:B59,"<="&G2)

    G5 shows 2,218.48 and G6 72.71.

    Every condition earns its place

    Try removing one at a time and watch G5:

    Conditions Largest order
    status and both dates 2,218.48
    both dates, no status 3,149.12 (a cancelled order)
    status, no dates 5,216.96 (November 18)

    A number that looks impressive is often a filter that’s missing. When an extreme surprises you, find the row it comes from before you report it. =XLOOKUP(G5,D2:D59,A2:A59) from chapter 2 returns the order id: 12161, placed on November 29.

    When nothing matches

    MAXIFS and MINIFS return 0 when no row passes the tests, not an error. Set G3 to pending: there are no pending orders in this window, and both cells show 0. A “smallest order of 0” is a sign the filter found nothing, so check the inputs before you read it as a free order. AVERAGEIFS is more honest here, with #DIV/0!.

    Common mistakes

    • Dates with times. This sheet stores plain dates. If order_date held a time too, "<="&G2 would stop at midnight at the start of December 1 and drop that day’s orders. Use "<"&G2+1 (before the next day) for timestamps.
    • > instead of >=. ">"&G1 silently drops the first day of the promo, Black Friday itself.
    • Older Excel. MAXIFS and MINIFS arrived in Excel 2019; Microsoft 365 and Google Sheets have them. In Excel 2016 they show #NAME?.
    • Quotes around the cell. ">=G1" compares with the text G1 and nothing matches.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.