1. Lighthouse

Level 2 · A filter you can check, written as a formula

The request

From Andrew Ramos, Marketing Manager

“We're planning a web-only kitchen and decor email. From the mid-September order lines, how many web lines were Kitchen or Decor, and what did they bring in? Put the channel and the two categories in cells so I can swap them.”

Your goal

In G2:G41, return TRUE for each line whose channel (column C) equals the channel in J1 AND whose category (column E) equals either J2 or J3, and FALSE otherwise; use AND with OR inside. In J5, count the TRUE rows with COUNTIF. In J6, add up their line_total (column F) with SUMIF.

  • Fill G2:G41, J5:J6 with the right valuesnot done yet
  • With formulas, not typed numbersnot done yet
  • Use AND ORnot done yet

Your sheet

Excel
The sheet for this level
ABCDEFGHIJK
1order_idorder_datechannelproductcategoryline_totalkeepChannelweb
2109462025-09-15webCedar Concrete Grill Tool SetOutdoor72.99Category 1Kitchen
3109482025-09-15appHarbor Acacia Solar LanternOutdoor578.00Category 2Decor
4109492025-09-15webThatcher Acacia Dutch OvenKitchen13.99
5109492025-09-15webDelancey Brass VaseDecor19.99Lines kept
6109502025-09-15webWillow Acacia Knife BlockKitchen53.99Revenue kept
7109512025-09-15webAshford Linen Pendant LightLighting349.00
8109512025-09-15webDelancey Jute Area RugTextiles30.99
9109512025-09-15webDriftwood Percale Area RugTextiles27.99
10109522025-09-15webThatcher Marble Candle Holder SetDecor31.98
11109522025-09-15webCove Jute Duvet CoverTextiles219.00
12109532025-09-15marketplaceTidewater Teak LoveseatFurniture629.00
13109552025-09-15appMaple Wool Throw PillowTextiles56.97
14109552025-09-15appMonroe Glass Desk LampLighting239.92
15109552025-09-15appWeston Cashmere-Blend QuiltTextiles51.98
16109572025-09-16webCove Cast Iron Dutch OvenKitchen10.99
17109572025-09-16webOrchard Walnut Side TableFurniture439.00
18109572025-09-16webBirch Brass Floor MirrorDecor20.99
19109572025-09-16webOakley Enamel Dutch OvenKitchen109.00
20109572025-09-16webWeston Ash Bed FrameFurniture3198.00
21109582025-09-16appDelancey Black Metal Wall SconceLighting54.99
22109592025-09-16appNantucket Brass Wall MirrorDecor17.99
23109592025-09-16appNorthfield Teak Charcoal GrillOutdoor53.99
24109602025-09-16appGlen Stoneware CarafeKitchen182.97
25109602025-09-16appCove Wool Lumbar PillowTextiles52.99
26109602025-09-16appVale Enamel Bowl SetKitchen95.92
27109602025-09-16appBirch Brass Floor MirrorDecor41.98
28109602025-09-16appQuarry Ceramic Picture LightLighting658.00
29109612025-09-16webDelancey Brass VaseDecor19.99
30109612025-09-16webAlder Oak Coffee TableFurniture919.00
31109612025-09-16webVale Cashmere-Blend Knit ThrowTextiles37.98
32109612025-09-16webThatcher Oak CandleDecor71.96
33109622025-09-16marketplaceHarbor Oak Floor MirrorDecor89.98
34109622025-09-16marketplaceRidge Soy Wax VaseDecor109.00
35109632025-09-16appFairhaven Brass Wall SconceLighting756.00
36109632025-09-16appMonroe Glass Desk LampLighting29.99
37109632025-09-16appUpland Percale Lumbar PillowTextiles159.00
38109632025-09-16appDune Black Metal Pendant LightLighting189.00
39109632025-09-16appGlen Stoneware CarafeKitchen60.99
40109642025-09-16appVale Enamel Bowl SetKitchen23.98
41109642025-09-16appWeston Ash Bed FrameFurniture1599.00
42
43

Loading the editor…

    ResultPress Check to compare G2:G41, J5:J6

    Mote checks your result

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

    The lesson

    Andrew wants a slice of the data: web orders, Kitchen or Decor. In Excel you’d usually click your way there with a filter. That’s fine for looking, but the moment someone asks “how many, and how much?”, you want the rule written down where the numbers can follow it. This level does both.

    Filtering in Excel

    Click any cell in the data and turn on Data → Filter (Ctrl+Shift+L; Google Sheets: Data → Create a filter). Each header gets a drop-down arrow:

    • Untick Select All, tick web in the channel drop-down.
    • In the category drop-down, tick Kitchen and Decor.

    Ticks inside one column are OR (Kitchen or Decor). Filters on different columns are AND (web and one of those categories). The drop-downs also have Text Filters (Contains, Begins With), Number Filters (Greater Than, Between, Top 10) and Date Filters (Before, After, This Month) for rules a tick list can’t express. The status bar shows “9 of 40 records found”, and a filter icon on the header reminds you the view is filtered.

    While you scroll a long list, keep the headers in view with View → Freeze Panes → Freeze Top Row. Freeze Panes on a selected cell freezes everything above and to the left of it, handy when the id column should stay visible too.

    Advanced Filter: the rule written in cells

    Data → Advanced (Sort & Filter group) takes a criteria range: header names copied above the conditions. Conditions on the same row are AND, conditions on separate rows are OR:

    channel category
    web Kitchen
    web Decor

    That reads “web AND Kitchen, OR web AND Decor”. Advanced Filter can also copy the matching rows to another place. It doesn’t update by itself, though: change the data and you have to run it again.

    The same rule as a formula

    A criteria column turns the filter into a TRUE/FALSE per row. With the inputs in J1:J3:

    G2   =AND(C2=$J$1,OR(E2=$J$2,E2=$J$3))

    Row 4 is order 10949, web, a Thatcher Acacia Dutch Oven in Kitchen: C4="web" is TRUE, E4="Kitchen" is TRUE, so G4 is TRUE. Row 3 is a Solar Lantern bought in the app: the AND fails on the channel, so G3 is FALSE, whatever the category. Text comparisons with = ignore case, so "Web" would match too. The inputs are locked with $ because every row reads the same three cells.

    Then the answers Andrew asked for:

    J5   =COUNTIF(G2:G41,TRUE)
    J6   =SUMIF(G2:G41,TRUE,F2:F41)

    Change J1 to app and both numbers update. That’s the advantage over a ticked filter: the rule is visible, reusable, and checkable.

    Filtered totals in Excel

    A plain SUM(F2:F41) keeps adding hidden rows when a filter is on. Excel’s SUBTOTAL(109, F2:F41) (or AGGREGATE) adds only the visible ones, and the Total Row of an Excel Table uses it for you. The criteria column avoids the question altogether, because the filter lives in the formula.

    Common mistakes

    • Putting every test in one AND: a row can’t be Kitchen and Decor at once, so nothing matches.
    • Using OR for everything: that keeps every web line plus Kitchen and Decor lines from any channel.
    • Leaving J1 relative: filled down, it becomes J2, then J3, and each row tests a different input.
    • Summing the visible rows of a filtered range with SUM and reporting it as the filtered total.

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