The request

From Amanda Perez, Accountant
Your goal
In F2:F55, compute each line's net total: quantity × unit_price × (1 − discount_pct ÷ 100). Then in I2:I24, next to each order_id in column H, add up that order's line totals with SUMIF on column A. Lock the two ranges with $ so the formula fills down.
- Fill
F2:F55, I2:I24with the right valuesnot done yet - With formulas, not typed numbersnot done yet
- Use
SUMIFnot done yet
Your sheet
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | order_id | category | quantity | unit_price | discount_pct | line_total | order_id | order_total | ||
| 2 | 11826 | Lighting | 1 | 159.00 | 0 | 11826 | ||||
| 3 | 11826 | Textiles | 1 | 28.99 | 0 | 11827 | ||||
| 4 | 11827 | Decor | 1 | 149.00 | 0 | 11828 | ||||
| 5 | 11828 | Textiles | 1 | 52.99 | 0 | 11829 | ||||
| 6 | 11829 | Textiles | 1 | 139.00 | 10 | 11830 | ||||
| 7 | 11829 | Textiles | 1 | 30.99 | 10 | 11831 | ||||
| 8 | 11829 | Textiles | 3 | 159.00 | 10 | 11832 | ||||
| 9 | 11830 | Decor | 1 | 19.99 | 0 | 11833 | ||||
| 10 | 11830 | Decor | 3 | 12.99 | 0 | 11834 | ||||
| 11 | 11831 | Furniture | 2 | 169.00 | 0 | 11835 | ||||
| 12 | 11831 | Textiles | 1 | 84.99 | 0 | 11836 | ||||
| 13 | 11832 | Furniture | 3 | 169.00 | 0 | 11837 | ||||
| 14 | 11832 | Textiles | 2 | 139.00 | 0 | 11838 | ||||
| 15 | 11832 | Lighting | 1 | 189.00 | 0 | 11839 | ||||
| 16 | 11833 | Lighting | 1 | 92.99 | 0 | 11840 | ||||
| 17 | 11834 | Lighting | 2 | 349.00 | 0 | 11841 | ||||
| 18 | 11834 | Decor | 2 | 20.99 | 0 | 11842 | ||||
| 19 | 11835 | Kitchen | 1 | 16.99 | 0 | 11843 | ||||
| 20 | 11835 | Textiles | 1 | 139.00 | 0 | 11844 | ||||
| 21 | 11835 | Textiles | 2 | 52.99 | 0 | 11845 | ||||
| 22 | 11836 | Textiles | 3 | 70.99 | 0 | 11846 | ||||
| 23 | 11836 | Kitchen | 2 | 289.00 | 0 | 11847 | ||||
| 24 | 11836 | Textiles | 1 | 169.00 | 0 | 11848 | ||||
| 25 | 11836 | Kitchen | 1 | 16.99 | 0 | |||||
| 26 | 11837 | Lighting | 4 | 92.99 | 0 | |||||
| 27 | 11837 | Textiles | 3 | 169.00 | 0 | |||||
| 28 | 11837 | Textiles | 2 | 20.99 | 0 | |||||
| 29 | 11837 | Decor | 2 | 76.99 | 0 | |||||
| 30 | 11837 | Textiles | 8 | 18.99 | 0 | |||||
| 31 | 11838 | Decor | 2 | 15.99 | 0 | |||||
| 32 | 11839 | Textiles | 1 | 28.99 | 0 | |||||
| 33 | 11840 | Decor | 1 | 104.99 | 0 | |||||
| 34 | 11840 | Kitchen | 1 | 70.99 | 0 | |||||
| 35 | 11841 | Decor | 2 | 19.99 | 0 | |||||
| 36 | 11841 | Textiles | 1 | 139.00 | 0 | |||||
| 37 | 11841 | Decor | 3 | 159.00 | 0 | |||||
| 38 | 11841 | Lighting | 3 | 189.00 | 0 | |||||
| 39 | 11841 | Furniture | 4 | 259.00 | 0 | |||||
| 40 | 11842 | Lighting | 2 | 54.99 | 10 | |||||
| 41 | 11843 | Decor | 1 | 15.99 | 0 | |||||
| 42 | 11843 | Textiles | 1 | 52.99 | 0 | |||||
| 43 | 11843 | Textiles | 2 | 139.00 | 0 | |||||
| 44 | 11843 | Furniture | 1 | 999.00 | 0 | |||||
| 45 | 11843 | Kitchen | 1 | 13.99 | 0 | |||||
| 46 | 11844 | Furniture | 1 | 179.00 | 0 | |||||
| 47 | 11845 | Textiles | 2 | 23.99 | 0 | |||||
| 48 | 11845 | Textiles | 1 | 52.99 | 0 | |||||
| 49 | 11846 | Decor | 4 | 15.99 | 10 | |||||
| 50 | 11846 | Lighting | 1 | 279.00 | 10 | |||||
| 51 | 11846 | Decor | 3 | 19.99 | 10 | |||||
| 52 | 11846 | Kitchen | 2 | 13.99 | 10 | |||||
| 53 | 11846 | Kitchen | 1 | 10.99 | 10 | |||||
| 54 | 11847 | Kitchen | 9 | 60.99 | 0 | |||||
| 55 | 11848 | Textiles | 1 | 28.99 | 0 | |||||
| 56 | ||||||||||
| 57 |
Loading the editor…
Reference solution
Mote checks your result
Press Check. Each right cell becomes a firefly in your lantern.
What Amanda gets, and why
The lesson
A sales export has one row per order line: a lamp and a throw in the same basket are two rows. Most questions, though, are about orders: what did each customer pay, how many orders did we get, what is the average order worth? This level builds the bridge between the two, and the rest of the chapter stands on it.
The sheet holds every line of the 23 orders placed on Monday, November 17, 2025: 54 lines in
A2:E55. Column H lists each order id once. Amanda’s full month is 1,600 lines; once the formulas
work on this sample, they work on the month.
Step 1: what each line earned
The revenue definition is the same one the SQL and pandas holiday case uses: quantity × price ×
(1 − discount ÷ 100). In F2:
=C2*D2*(1-E2/100)
Fill it down to F55. Most lines have no discount, so F2 is simply 1 × 159 = 159.00. Row 6 is
order 11829, which used a 10% code: 1 × 139 × 0.9 = 125.10.
Step 2: SUMIF by order id
SUMIF adds the values in one range where another range matches a criterion:
| argument | here | meaning |
|---|---|---|
| range | $A$2:$A$55 |
where to look for the order id |
| criteria | H2 |
the id to match |
| sum_range | $F$2:$F$55 |
what to add up, row by row |
I2 =SUMIF($A$2:$A$55,H2,$F$2:$F$55)
For order 11829 (H5), SUMIF finds three lines in rows 6 to 8 and adds 125.10 + 27.89 + 429.30
= 582.29. The two ranges must be the same size and start on the same row, because the function
pairs them up position by position.
Lock both ranges with $ and leave H2 relative, then fill down to I24. Every row searches all
54 lines for its own id.
Check that both sides agree
A roll-up must not create or lose money. Put =SUM(F2:F55) and =SUM(I2:I24) in two spare cells:
both show 10,937.42. If the order side is lower, an id in H is missing or mistyped; if it is
higher, an id is listed twice. This one check catches most roll-up mistakes before anyone else
sees them.
The same habit matters when you move to the full month. In the SQL case, November 2025 comes out at 651 orders and 292,364.40 of net revenue. A spreadsheet built from the same lines with the same definition has to land on exactly those numbers, and level 6 shows that it does.
Why lock ranges that seem to work unlocked
Try =SUMIF(A2:A55,H2,F2:F55) without dollar signs. On this sheet it happens to give the right
answers: filled down, I10 searches A10:A63, and because the lines are sorted by order id,
order 11834’s lines (rows 16 and 17) are still inside that window. Sort the lines by category
tomorrow and the window starts skipping lines that belong to the order. Lock the ranges so the
formula does not depend on how the data happens to be sorted.
Common mistakes
- Summing the price column.
$D$2:$D$55adds unit prices and ignores quantity and discount: order 11829 shows 328.99 instead of 582.29. - Swapping range and sum_range.
=SUMIF($F$2:$F$55,H2,$A$2:$A$55)looks for the order id among the line totals, finds nothing, and every order shows 0. - Ranges of different sizes. Keep the criteria range and the sum range the same height and starting row, or the rows are paired wrongly.
- Treating the discount as a fraction.
(1-E2)turns a 10% code into a negative line: row 6 becomes −1,251.
Lantern lit!
Practised: sumifline totalsabsolute referencesreconciliation
- Solved
- No hints
- First run
