The request

From Susan Diaz, Growth Marketer
Your goal
Using the channel in G1 and the status in G2: in G4, count the orders that match both with COUNTIFS; in G5, add up their subtotals (D2:D57) with SUMIFS; in G6, average their subtotals with AVERAGEIFS. Channels are in B2:B57, statuses in C2:C57.
- Fill
G4:G6with the right valuesnot done yet - With formulas, not typed numbersnot done yet
- Use
COUNTIFSSUMIFSAVERAGEIFSnot done yet
Your sheet
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | order_id | channel | status | subtotal | Channel | app | ||
| 2 | 12059 | app | refunded | 424.46 | Status | completed | ||
| 3 | 12060 | app | completed | 119.94 | ||||
| 4 | 12061 | web | completed | 8.99 | Orders | |||
| 5 | 12062 | web | completed | 339.86 | Revenue | |||
| 6 | 12063 | app | completed | 132.97 | Average order | |||
| 7 | 12064 | app | completed | 2002.88 | ||||
| 8 | 12065 | app | completed | 136.95 | ||||
| 9 | 12066 | app | completed | 26.99 | ||||
| 10 | 12067 | web | completed | 478.96 | ||||
| 11 | 12068 | marketplace | completed | 91.96 | ||||
| 12 | 12069 | app | completed | 25.99 | ||||
| 13 | 12070 | app | completed | 63.73 | ||||
| 14 | 12071 | app | completed | 24.74 | ||||
| 15 | 12072 | app | completed | 323.95 | ||||
| 16 | 12073 | web | completed | 227.95 | ||||
| 17 | 12074 | app | completed | 84.98 | ||||
| 18 | 12075 | app | completed | 613.43 | ||||
| 19 | 12076 | app | completed | 1152.73 | ||||
| 20 | 12077 | app | refunded | 188.98 | ||||
| 21 | 12078 | app | completed | 27.98 | ||||
| 22 | 12079 | web | completed | 52.99 | ||||
| 23 | 12080 | app | completed | 40.49 | ||||
| 24 | 12081 | app | completed | 60.99 | ||||
| 25 | 12082 | web | completed | 100.48 | ||||
| 26 | 12083 | marketplace | completed | 313.96 | ||||
| 27 | 12084 | app | completed | 17.99 | ||||
| 28 | 12085 | web | completed | 1754.97 | ||||
| 29 | 12086 | marketplace | completed | 183.99 | ||||
| 30 | 12087 | app | completed | 317.92 | ||||
| 31 | 12088 | app | completed | 14.24 | ||||
| 32 | 12089 | app | completed | 1240.94 | ||||
| 33 | 12090 | web | completed | 69.74 | ||||
| 34 | 12091 | web | completed | 129.99 | ||||
| 35 | 12092 | app | completed | 33.74 | ||||
| 36 | 12093 | web | completed | 97.49 | ||||
| 37 | 12094 | web | completed | 976.31 | ||||
| 38 | 12095 | app | cancelled | 63.98 | ||||
| 39 | 12096 | app | completed | 91.49 | ||||
| 40 | 12097 | web | completed | 28.99 | ||||
| 41 | 12098 | marketplace | completed | 1221.00 | ||||
| 42 | 12099 | app | completed | 21.74 | ||||
| 43 | 12100 | web | completed | 339.97 | ||||
| 44 | 12101 | app | completed | 116.98 | ||||
| 45 | 12102 | marketplace | completed | 399.97 | ||||
| 46 | 12103 | marketplace | completed | 125.99 | ||||
| 47 | 12104 | app | completed | 34.49 | ||||
| 48 | 12105 | marketplace | completed | 31.98 | ||||
| 49 | 12106 | app | refunded | 263.24 | ||||
| 50 | 12107 | web | completed | 1062.81 | ||||
| 51 | 12108 | marketplace | completed | 29.99 | ||||
| 52 | 12109 | web | completed | 224.98 | ||||
| 53 | 12110 | app | cancelled | 252.71 | ||||
| 54 | 12111 | marketplace | completed | 289.00 | ||||
| 55 | 12112 | app | completed | 159.74 | ||||
| 56 | 12113 | app | completed | 86.97 | ||||
| 57 | 12114 | app | completed | 418.49 | ||||
| 58 | ||||||||
| 59 |
Loading the editor…
Reference solution
Mote checks your result
Press Check. Each right cell becomes a firefly in your lantern.
What Susan gets, and why
The lesson
SUMIF takes one condition. Susan’s question has two: the app and completed. For that you
use the plural versions, COUNTIFS, SUMIFS and AVERAGEIFS, which take as many conditions as
you need.
Conditions come in pairs
Every condition is a pair of arguments: a range to test, then what it must match.
=COUNTIFS(B2:B57,"app",C2:C57,"completed")
reads as “count the rows where B is app and C is completed”. Excel checks the pairs row by
row: row 2 passes only if B2 is app and C2 is completed. On Black Friday that is 27 orders.
Add a third pair and a row must pass three tests. The ranges must all have the same size, or the
formula returns #VALUE!.
SUMIFS puts the sum range first
=SUMIFS(sum_range, range1, criteria1, range2, criteria2, …)
This is the trap of the whole family. SUMIF has the range to add up last; SUMIFS has it
first, so the pairs can go on as long as needed:
| Function | Arguments |
|---|---|
SUMIF |
range, criteria, sum_range |
SUMIFS |
sum_range, range1, criteria1, … |
AVERAGEIFS |
average_range, range1, criteria1, … |
COUNTIFS |
range1, criteria1, … (nothing to add up) |
With the inputs in G1 and G2:
G4 =COUNTIFS(B2:B57,G1,C2:C57,G2)
G5 =SUMIFS(D2:D57,B2:B57,G1,C2:C57,G2)
G6 =AVERAGEIFS(D2:D57,B2:B57,G1,C2:C57,G2)
G5 shows 7,393.47 and G6 273.83. SUMIFS with a single pair does the same job as SUMIF,
so many analysts use only the S versions: one argument order to remember.
What the status test changes
Leave the status out and the app looks better than it was. =COUNTIF(B2:B57,G1) counts 32 app
orders, and =SUMIF(B2:B57,G1,D2:D57) adds up to 8,586.84. The extra 5 orders are 2 cancelled
and 3 refunded ones: 1,193.37 that the store never kept. A dashboard that reports the bigger
number overstates Black Friday app revenue by about 16%.
Check the average by hand
An average is a sum divided by a count, so G6 should equal G5/G4: 7,393.47 / 27 = 273.83. If
they differ, the two formulas are not testing the same rows. AVERAGEIFS returns #DIV/0! when no
row matches, for example after a typo such as complete in G2. That error is useful: it tells
you the filter found nothing, where SUMIFS would quietly show 0.
Common mistakes
- SUMIF order in SUMIFS.
=SUMIFS(B2:B57,G1,D2:D57,…)tests the wrong columns. In theSversions the sum range is always first. - OR instead of AND.
SUMIFSonly does AND. For “app or web”, add two of them:=SUMIFS(D2:D57,B2:B57,"app")+SUMIFS(D2:D57,B2:B57,"web"). - Ranges that don’t line up.
B2:B57withC3:C58compares each channel with the next row’s status. Same first row, same last row. - Averaging the average. The average order value is total revenue over the number of orders, not an average of daily averages.
Lantern lit!
Practised: sumifscountifsaverageifscriteriaconditional aggregates
- Solved
- No hints
- First run
