Asking questions data can answer
Which rows and which columns?
Every clear question tells you which rows to keep and which columns to use; saying them out loud before you start prevents most mistakes.
By the end of this lesson you can say exactly which rows and columns a question needs.
Why it matters
Analysts often get wrong answers from correct sums, because they added up the wrong rows. A quick plan ("these rows, this column") catches that before it happens.
The idea in plain words
Think of a library. To answer "how many pages are in the cookbooks on the second floor?", you do not read every book. You go to the right shelves (the second floor, the cookbook section), and you look at one thing about each of those books: its number of pages.
A table is the same. A clear question tells you two things:
- Which rows to keep: the ones that match the question's who, where and when. In a library, that is the right shelves.
- Which columns to use: the ones you need to pick the rows, plus the one that holds the answer.
Condition: a rule a row must pass to be kept, such as "day is Fri" or "fruit is Pawpaw".
Before touching the data, say out loud: "these rows, these columns".
See it done
Question: how many pawpaws did Amara sell on Friday 6 March 2026?
Data:
market-stall-week.csv(synthetic).
- Find the conditions. The question names a day (Friday) and a fruit (pawpaw). So a row is kept only if day is Fri and fruit is Pawpaw. Both must be true.
- Find the answer column. "How many pawpaws" means the number of fruits, not the number of sales. That is the
quantitycolumn. - List the columns you need.
dayandfruit(to pick rows), andquantity(for the answer). - Keep the rows. Friday is rows 40 to 51: 12 rows. Of those, only 2 are pawpaw: rows 48 and 49 (sales S047 and S048).
- Use the answer column. Their quantities are 3 and 2. 3 + 2 = 5.
- Answer in a sentence. "Amara sold 5 pawpaws on Friday 6 March 2026, in 2 sales."
12 Friday rows, 2 of them pawpaw, 5 pawpaws in total.
Notice step 2. If you had counted rows instead, you would have said "2". That answers "how many pawpaw sales", which is a different question.
Your turn, with help
Question: how many of Lucía's pupils in class 5B walk to school?
Write the conditions and the column(s) you need. Then find the answer in your sheet.
Hint: this question asks "how many pupils". One row is one pupil. So you count rows. You do not add up a column.
Show the answer
- Conditions:
classis 5B andtravel_modeis Walk. - Columns:
classandtravel_mode. No answer column to add up: you count the rows that pass. - Answer: 4 pupils.
Your turn, alone
For each question, write the conditions, and say whether you count rows or add up a column (and which one). You do not need the answers yet.
- How many sales did Amara make on Thursday?
- How many mangoes did Amara sell in the whole week?
- How many minutes, in total, do pupils in class 5A spend getting to school each morning?
- How many of Amara's Saturday sales were paid by card?
Check your answers
- Condition: day is Thu. Count rows.
- Condition: fruit is Mango. Add up
quantity. - Condition: class is 5A. Add up
travel_minutes. - Conditions: day is Sat and payment is Card. Count rows.
Watch out
- Counting rows when you should add. "How many pawpaws" (add
quantity) is not "how many pawpaw sales" (count rows). Read the question twice. - Missing a condition. "Pawpaws on Friday" has two conditions. Keep only rows that pass both.
- Using the wrong period. If the question says one day, do not use the whole week.
Say it back
- What is a condition?
- "How many sales on Monday": count rows or add a column?
- "How many oranges on Monday": count rows or add a column? Which column?
Show the answers
- A rule a row must pass to be kept.
- Count rows (one row is one sale).
- Add a column:
quantity, for rows where day is Mon and fruit is Orange.
What is next
Finding rows by eye works for 60 rows. What about 6,000? Next you learn to make the spreadsheet move the rows you want to the top, in one click.