Teacher block: Apio's aunt asks three questions
Apio shows her aunt the spreadsheet. Her aunt asks three questions.
“Which things did we sell the most of? How much money did food make, and how much did school things make? And which sales were big ones, so I can thank those customers?”
The data is all there. How can Apio answer each question in seconds, not an hour?
Teacher block: Recall from yesterday and last week
Answer on paper, then check with a neighbour.
- What is the difference between COUNT and COUNTA?
- What does the dollar sign do in
=F2/$F$15? - A cell shows ##### in a number column. What do you do?
- Name one question you ask about a source before you trust it.
Teacher block: The cards that counted a country
Every few years a country counts its people. This is called a census. Uganda does it too. In the United States, the count of 1880 took years to add up by hand.
For the count of 1890, an engineer named Herman Hollerith built a machine that read cards. Each person’s answers were punched as holes in one card. The machine counted the cards by their holes, for example by age group or by job, and a sorting box put the cards into groups. The count was finished much faster. His company later became part of IBM.
One card for each person is one row for each record. Counting the rows that match a rule is what COUNTIF does for you today. What question would you like to ask your own data by counting?
Teacher block: A good table, sort and filter
A table in a spreadsheet is data in a tidy block. Four rules make a table that the program can sort and filter:
- One header row at the top, with a short name for each column.
- One fact per cell. Not “Mon beans” in one cell, but Mon in one and Beans in another.
- No empty rows or columns inside the table.
- One kind of thing per column. All numbers, or all words.
Sort puts the rows in an order, such as the smallest total first, or A to Z. The whole row moves together.
Filter hides the rows you do not want. The data is not deleted, only hidden. The row numbers on the left turn blue, or skip, to show that rows are hidden.
Freeze the header row so it stays on screen when you scroll down a long list.
Sort the whole table
Click one cell inside the table, then sort. Each row moves as one, so every item keeps its own total.
Sort one column alone
Select only the Total column, then sort. The totals move, the items stay, and the table is now wrong.
Teacher block: IF, a decision in a cell
The IF function makes a decision. It has three parts, separated by commas:
=IF(test, answer if true, answer if false)
Example for the Shop week data, to mark big sales:
=IF(F2>=50000,"Big","Small")
Read it aloud: “If F2 is 50000 or more, show Big. If not, show Small.”
Tests use these signs: > bigger than, >= bigger than or equal to, = equal to, <> not equal to. Words in a formula go inside straight double quotes.
Teacher block: COUNTIF and SUMIF
Two functions that count and add only the rows that pass a test.
=COUNTIF(range, test) counts how many cells pass the test.
=SUMIF(test range, test, sum range) adds the cells in one column for the rows where another column passes the test.
| Question | Formula | Answer |
|---|---|---|
| How many food sales? | =COUNTIF(B2:B13,"Food") |
6 |
| How many sales of 50000 or more? | =COUNTIF(F2:F13,">=50000") |
5 |
| How much money did Food make? | =SUMIF(B2:B13,"Food",F2:F13) |
330500 |
| How much did Monday make? | =SUMIF(E2:E13,"Mon",F2:F13) |
127500 |
In SUMIF, the first range is where the test is looked for. The last range is what gets added. Both ranges have the same size.
Check a SUMIF by hand, on this page. IF, COUNTIF and SUMIF need Excel or Calc. This practice grid does not have them, but it can check an answer a second way. The Food rows are 2, 3, 4, 5, 10 and 12. Click C15 and type =C2+C3+C4+C5+C10+C12. Does it give 330500, the same as the SUMIF?
Teacher block: Ask the data a question
Choose the tool. Write the answer. No laptop yet.
Name:
Use the Shop week data on the wall. For each question, circle the tool you would use (Sort, Filter, IF, COUNTIF, SUMIF) and write the answer.
-
How many sales were in the School category? Tool: Answer:
-
How much money did Household make? Tool: Answer:
-
Which sale was biggest? Tool: Item and day:
-
The formula
=IF(F2>=50000,"Big","Small")is in H2 and filled down. How many cells in H show Big? -
How much money did the shop make on Friday? Tool: Answer:
-
Write your own question about the data, the tool you would use, and the answer.
Your teacher will read this answer. Choose who is learning (top of the page) to save this answer.
Teacher block: Quick check
Teacher block: Say your finding
Reasoning with data. Pick one answer from today’s worksheet and say it to your partner as a full sentence, with a number and a reason.
For example: “Food made 330,500 shillings, which is about two thirds of the week, so the shop should never run out of food.”
Laptop block: Sort, filter and freeze
No teacher is with you. Work in pairs, or alone if you are the only Pioneer. Swap driver and navigator after about 5 minutes.
- Open Excel, or LibreOffice Calc, which is free. Open Shop week from University, Spreadsheets.
- Click any cell inside the data, for example A5. Do not select a single column.
- Switch on the filter buttons. In Excel: Data, Filter. In Calc: Data, AutoFilter. On Windows, Ctrl + Shift + L works in both. Small arrows appear in the heading row.
- Sort. Click the arrow on Total (UGX). Choose sort from largest to smallest (Excel: Sort Largest to Smallest. Calc: Sort Descending). Check that Beans on Monday is first, with 67500, and Pen is last, with 20000. Check that each item still has its own total.
- Now sort by Category from A to Z. Check that Food comes first and Services last, and that every row still has its own total. Then press Ctrl + Z (Command + Z) twice to undo both sorts and go back to the original order.
- Filter. Click the arrow on Category. Untick all, and tick Food only. Check that 6 rows show. Now set Category back to all: click its arrow and tick Select All (or every box). Then filter Day to Thu. Check that 2 rows show.
- Clear. Tick every box again, or choose Select All in each list. All 12 rows return.
- Freeze the header row. In Excel: View, Freeze Panes, Freeze Top Row. In Calc: View, Freeze Cells, Freeze First Row. Scroll down to check that row 1 stays visible.
- Make the money columns easy to read. Select D2:D13. Then hold Ctrl (Command on the Mac) and select F2:F13, so both are selected together. Open Format Cells with Ctrl + 1 (Command + 1). Choose Number, 0 decimal places, and tick the thousands separator. In Excel it is called Use 1000 Separator. In Calc it is called Thousands separator. Click OK. 60000 now shows 60,000.
- Save with Ctrl + S (Command + S).
If you want colour in Excel, the Format as Table button on the Home tab adds neat stripes. Do not use it today: it changes how formulas name the cells, and those formulas may not work the same way in Calc.
Laptop block: IF, COUNTIF and SUMIF
Predict first, then type. Compare your prediction with the screen.
- In H1 type the heading Size. In H2 type
=IF(F2>=50000,"Big","Small"). Press Enter. Type the quotes as straight quotes. Fill down from H2 to H13 with Ctrl + D (Command + D). - Check. H2 shows Big, H5 shows Big, H6 shows Small. H4 is Big, because Sugar is exactly 50000.
- Under your summary, in column A rows 24 to 30, type these labels. (Rows 21 and 22 may hold yesterday’s challenges.) In column F type the formulas. Predict each result before you press Enter.
| Label in column A | Formula in column F | Answer |
|---|---|---|
| Food sales (count) | =COUNTIF(B2:B13,"Food") |
6 |
| School sales (count) | =COUNTIF(B2:B13,"School") |
3 |
| Big sales (count) | =COUNTIF(H2:H13,"Big") |
5 |
| Food money (UGX) | =SUMIF(B2:B13,"Food",F2:F13) |
330500 |
| Household money (UGX) | =SUMIF(B2:B13,"Household",F2:F13) |
62000 |
| School money (UGX) | =SUMIF(B2:B13,"School",F2:F13) |
80000 |
| Monday money (UGX) | =SUMIF(E2:E13,"Mon",F2:F13) |
127500 |
- If a formula shows an error, check for #NAME? (a word in quotes is missing its quotes, or a curly quote was typed) and check that the commas are in the right places. If the program does not accept commas, try a semicolon between the parts.
- Check yourself: Food 330500 plus Household 62000 plus School 80000 plus Services 30000 should be 502500, your grand total. Add the Services money in F31 with
=SUMIF(B2:B13,"Services",F2:F13)and check that all four add to F15. - Save with Ctrl + S (Command + S).
Name:
-
What does H4 show?
-
What does the Food count show?
-
What does the Food money show?
-
What does the Services money show?
-
What do the four category totals add up to?
Laptop block: Challenges
Bronze
Filter the table to show Food only. Select the Total cells that show (F2 down to F13). Read the Sum at the bottom of the window, in the status bar: it adds only the rows you can see. Then clear the filter. Compare it with your SUMIF result. They must match.
Silver
Add a column I with the heading Speed. In I2 type =IF(C2>=20,"Fast","Slow") and fill down. Count the Fast rows with COUNTIF. Predict first. The answer is 4.
Gold
Write a question for the shop owner that needs two steps, such as “How much money did the Fast items make?” Answer it with SUMIF on the Speed column. Predict first. Fast items are Posho 60000, Airtime card 30000, Exercise book 37500 and Pen 20000, so the answer is 147500. Write your answer as one sentence.
Laptop block: Exit question
Write on paper, then say one sentence aloud to your partner.
Which tool would you use to find out how much money the shop made on Tuesday: filter, IF, or SUMIF? Why?
Laptop block: Home mission
Paper (no device). Write rows of data from your own course on paper, with a header row, for example test marks, patients, plots or cases. Write as many rows as you can, at least 6 and up to 15 to 20, with one column of words and one or two columns of numbers. If the data is invented, write “invented” at the top. Write one question about the data, the tool you would use (sort, filter, IF, COUNTIF or SUMIF), and the answer.
Phone (if you have one free). Find a table on a notice, a price list or a timetable and photograph it. Write two questions you could answer with a filter.
Laptop block: Prepare tomorrow's mentoring
Tomorrow the Explorers do Saving my work. Today they drew in the DrawPad. Tomorrow they open the text program (Notepad on the Lenovo, TextEdit on the MacBook) and type two sentences about their home. Then they press Ctrl + S (Command + S on the Mac), make a new folder named with their first name, name the file, for example My home, and click Save. Then they close the program, find their folder on the Desktop, and open the file again. Each learner does all nine steps with their own folder, about 10 minutes each, so both in a pair reach the skill.
Practise the whole task once on each laptop before class: the save box looks different on each, and on the Mac you may need to click the small arrow to see the New Folder button. Make sure the folder ends up on the Desktop, because the Explorers look for it there.
Write on a sheet:
- The first thing you will say. For example: “Your sentences are on the screen. Where will they go when the power goes off?”
- Two words you will use in plain English. For example “file name” and “folder”.
- The question you will ask instead of taking the mouse: “What name will you give it, so you can find it again?”
Practise with your partner. One of you is the Explorer, the other is the mentor. The mentor sits with hands behind the back.
← Functions that do the countingCharts that tell the truth →