A spreadsheet function is a ready-made calculation: you give it a range of cells and sometimes a condition, and it returns a result. A formula starts with = and can use one or more functions.
The questions use the sample orders: country in column E, status in column K and revenue in column J, rows 2 to 31. The names work the same in Excel, Google Sheets and LibreOffice. Formulas here separate arguments with semicolons; with some language settings your spreadsheet expects commas instead.
The exercise has four tasks and takes about 25 minutes. Open the CSV file in a spreadsheet next to it if you want to test your answers.
How to read a SUMIFS formula
=SUMIFS(J2:J31; E2:E31; "Germany"; K2:K31; "paid") reads from left to right as:
Add up the cells in J2:J31 (revenue),
but only in rows where E2:E31 (country) is "Germany",
and K2:K31 (status) is "paid".
The first range is always what gets added; then come pairs of "where to look" and "what to look for". On the sample orders it returns 1,644.00. COUNTIFS and AVERAGEIFS work the same way.
The error names are those of Excel and Google Sheets. LibreOffice uses the same names for most of them and shows a numbered error (such as Err:502) for a few others.
Common mistakes
SUM with a condition.
=SUM(J2:J31; "paid")does not filter anything. Conditions need SUMIF or SUMIFS.Swapped ranges in SUMIFS. The range to add comes first.
=SUMIFS(K2:K31; J2:J31; ...)tries to add up the status column.Ranges of different sizes.
J2:J31andK2:K30do not line up; the formula returns an error or a wrong result.Text without quotes.
=COUNTIF(K2:K31; paid)looks for a name called paid and returns #NAME? or 0. Write"paid".Forgetting the dollar signs. A copied formula moves its references; fix the ones that must stay put with
$.
For fast finishers
Build a pivot table of paid revenue by country. Check one country with SUMIFS: do both give the same figure?
Add a column L with
=IF(J2>400; "large"; "small")and count the large orders with COUNTIF.
Extension solutions
Paid revenue by country: United States 1,834, Germany 1,644, Japan 1,144, Portugal 1,141, Netherlands 1,091, Poland 788, India 737, Italy 596, France 494. Check, for example,
=SUMIFS(J2:J31; E2:E31; "Japan"; K2:K31; "paid"), which returns 1,144.=COUNTIF(L2:L31; "large")returns 8: eight orders are above 400.
Teacher notes
How to run it. Learners can do the tasks from the formulas alone, but they learn more with the CSV open: let them type each formula and compare. With a class link (unfold "Use it with a class" below the exercise) each learner hands in a result code, and Class results shows the class average per task.
Typical mistakes. COUNT chosen instead of COUNTIF (COUNT counts numbers, and column K holds text, so it returns 0). AVERAGE used for paid orders. In the blanks, learners type 10955.0 or a currency sign; the gaps accept 10955, 10,955, 10955.00 and 10,955.00 only, so tell learners to type the number as the spreadsheet shows it.
Follow-up questions.
Why might you prefer SUMIFS to a pivot table, and the other way round?
What changes if a new order is added in row 32? (The ranges must be extended, or the data turned into a table that grows by itself.)
How would you answer the same questions in SQL? The SQL sales data exercise uses the same table.
Differentiation. Easier: skip the error messages task and give learners the column letters on a card. Harder: ask for one formula that returns the share of refunded orders as a percentage (=COUNTIF(K2:K31; "refunded")/COUNTA(K2:K31), formatted as a percentage: 10 percent).
