1. Lighthouse

Level 4 · Criteria strings, wildcards and a threshold cell

The request

From Logan Brooks, Email Marketing Specialist

“Writing the BFCM recap email for the team. For Sunday the 30th I need three numbers: how many orders used a coupon at all, how many baskets hit our 'big basket' line (it's in H1, and we keep moving it), and revenue with cancelled and refunded orders left out.”

Your goal

In H3, count the orders with any coupon code in D2:D59 (COUNTIF with a wildcard). In H4, count the orders whose subtotal (E2:E59) is at least the threshold in H1 (COUNTIF, criterion built from H1 with &). In H5, add up the subtotals of orders whose status (C2:C59) is neither cancelled nor refunded (SUMIFS with two <> conditions).

  • Fill H3:H5 with the right valuesnot done yet
  • With formulas, not typed numbersnot done yet
  • Use COUNTIF SUMIFSnot done yet

Your sheet

Excel
The sheet for this level
ABCDEFGHI
1order_idchannelstatuscoupon_codesubtotalBig basket from250.00
212166appcompletedBFCM25256.40
312167webcompleted330.93Orders with a coupon
412168appcompletedBFCM25500.85Big baskets
512169appcompletedBFCM2517.99Revenue kept
612170webcompleted308.00
712171webcompleted378.00
812172appcompleted283.96
912173appcancelled33.98
1012174webcancelledBFCM253149.12
1112175appcompleted139.00
1212176webcompletedBFCM2545.74
1312177webcompleted41.98
1412178webcompleted384.96
1512179appcompleted200.99
1612180webcompletedBFCM251403.25
1712181marketplacecompleted412.92
1812182apprefunded1258.92
1912183appcompleted167.93
2012184webcompletedBFCM2529.99
2112185webcompleted234.96
2212186webcompleted421.99
2312187apprefundedBFCM2578.71
2412188appcompleted65.98
2512189appcompleted60.99
2612190appcompletedBFCM25106.48
2712191webcompleted161.95
2812192appcancelledBFCM2521.74
2912193webcompleted772.94
3012194appcompleted17.99
3112195appcompleted43.98
3212196appcompleted582.89
3312197appcompletedBFCM251667.99
3412198appcompletedBFCM25420.73
3512199marketplacecompletedBFCM25112.48
3612200appcompleted2252.97
3712201webcompletedBFCM2539.74
3812202marketplacecompletedBFCM2519.49
3912203appcompletedBFCM2574.98
4012204marketplacecompleted510.95
4112205appcompletedBFCM25105.74
4212206webcompleted805.94
4312207appcompleted16.99
4412208appcompletedBFCM25171.74
4512209appcompleted189.00
4612210webcompletedBFCM2562.97
4712211appcompletedBFCM25520.41
4812212appcompletedBFCM25551.21
4912213appcompleted17.99
5012214appcompletedBFCM25216.75
5112215webcompleted676.00
5212216appcompletedBFCM25163.50
5312217webcompleted77.98
5412218marketplacecompleted229.98
5512219appcompleted11.99
5612220appcompleted1265.00
5712221appcompletedBFCM2595.23
5812222appcompletedBFCM2539.74
5912223appcompleted65.98
60
61

Loading the editor…

    ResultPress Check to compare H3:H5

    Mote checks your result

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

    The lesson

    So far the criteria were plain values: app, completed, or a cell holding one. A criterion can also hold an operator and wildcards. That turns COUNTIF and SUMIFS into small filters: “at least 250”, “anything but cancelled”, “any coupon at all”.

    Operators in a criterion

    The criterion is text, so the operator goes inside the quotes with the value:

    Criterion Matches
    ">=250" numbers 250 and up
    ">250" numbers above 250 (250 itself is out)
    "<100" numbers below 100
    "<>cancelled" every cell that is not cancelled, blanks included
    "completed" or "=completed" exactly completed (any case)
    "" empty cells

    On this sheet =COUNTIF(E2:E59,">=250") counts the orders of 250 or more: 23 of 58. As in chapter 1, decide what happens at the edge. “Baskets of $250 and up” is >=; “over $250” is >.

    Building a criterion from a cell with &

    Logan keeps moving the line, so it lives in H1. The tempting formula is wrong:

    =COUNTIF(E2:E59,">=H1")

    Everything inside quotes is literal text, so this compares each subtotal with the word H1 and returns 0. Instead, keep the operator in quotes and join the cell to it with &:

    H4   =COUNTIF(E2:E59,">="&H1)

    ">="&H1 is evaluated first and becomes the text >=250. Change H1 to 100 and H4 updates. The same trick works for any operator and for dates: "<="&G2, "<>"&B1.

    Wildcards

    In a text criterion, * stands for any run of characters (including none) and ? for exactly one character:

    Criterion Matches
    "BF*" codes that start with BF, like BFCM25
    "*15" codes that end in 15, like SPRING15 and SUMMER15
    "*" any text at all, so every filled-in cell
    "~*" a literal asterisk (the ~ escapes it)

    Blank cells hold no text, so "*" skips them. That makes =COUNTIF(D2:D59,"*") the count of orders that used a coupon: 25. On Sunday every one of them was BFCM25, so =COUNTIF(D2:D59,"BF*") also gives 25. Wildcards only work on text; "2*" will not find numbers that start with 2.

    Two “not” tests on one column

    “Leave cancelled and refunded out” needs two conditions on the status column. SUMIFS accepts the same range twice:

    H5   =SUMIFS(E2:E59,C2:C59,"<>cancelled",C2:C59,"<>refunded")

    A row is kept only when it passes both tests, so cancelled rows fail the first and refunded rows fail the second. The result, 17,756.51, equals =SUMIF(C2:C59,"completed",E2:E59) today, because this day has no pending orders. The two formulas differ when a new status appears: the <> version keeps it, the completed version drops it. Pick the one that matches the definition your team uses.

    Common mistakes

    • Cell reference inside the quotes. ">=H1" is the text H1, not the value in H1.
    • Two <> tests joined in one string. "<>cancelled,refunded" looks for that exact text. Use two pairs.
    • <> and blank cells. "<>cancelled" also matches empty status cells. On a clean export that’s fine; on a messy one it can sweep in rows you didn’t mean. The next level looks at this.
    • Wildcards on numbers. * and ? match text only.

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