Sub topic 11
Checking results against your data
Gemini in Sheets can produce a table, a formula, or a chart in seconds. It can also produce one that looks right and is wrong. This chapter gives you a repeatable way to check each kind of output before you rely on it.
This chapter assumes you can open the Gemini side panel, write a prompt that names columns and ranges, and read basic formulas such as SUM and IF. Earlier chapters cover those skills.
Why checking is part of the workflow
Gemini predicts a plausible answer from your prompt and the data it can see. It does not run your business rules or know what your numbers should add up to. Three kinds of errors are common:
- Wrong range. The formula covers
D2:D50when your data runs to row 80, or it includes a header or a totals row. - Wrong meaning. You asked for "tax" and it applied 10% to the wrong column, or it matched "Groceries" exactly when your data also contains "groceries " with a trailing space.
- Wrong picture. A chart plots the right numbers under the wrong grouping, or it treats a number column as a label.
A wrong result usually does not produce an error message. It produces a number that is quietly off. Checking is how you find it.
The verification loop
Use the same four steps for every output.
- Read the formula, table, or chart settings and say in your own words what they do.
- Test on a small set of rows where you can see every value.
- Compare the result with a hand calculation.
- Apply to the full range only after the two agree.
Checking tables and templates
A generated table is mostly structure, so check the structure against what you asked for.
- Do the headers match the names you listed, in the order you listed them?
- Is there one header row and one record per row, with no merged cells or blank spacer rows?
- Does each column hold one type of value? Dates in
Date, numbers inAmount, text elsewhere. - Did Gemini add sample rows? Delete them or confirm they are clearly examples.
- Did it add columns you did not ask for?
For the expense table from the prompt design chapter, you asked for Date, Category, Description, Amount, and Paid By. Compare the header row with that list exactly.
You can also check types directly. In a spare cell, count how many Amount values are real numbers:
=COUNT(D2:D)Then count how many cells in the same column are not empty:
=COUNTA(D2:D)If the two results differ, some amounts are stored as text, for example "$12.50" typed with a stray character or pasted with a leading apostrophe. Formulas that add that column will skip those cells.
Checking formulas
Step 1: Read it
Ask Gemini to explain the formula it wrote, or read it yourself. Take this prompt and its result:
In column F, add a formula that shows the Amount from column D plus 10% tax, and leave the cell blank when column D is empty.A correct answer for row 2 looks like this:
=IF(D2="", "", D2*1.1)Read it in order. If D2 is empty, show nothing. Otherwise multiply D2 by 1.1. Check it against each part of your prompt: the target column (F), the source column (D), the calculation (plus 10%), and the edge case (blank when empty). If any part is missing, the formula is wrong even though it runs.
Step 2: Build a test case
Pick three or four rows and include the awkward ones: an empty row, a zero, a large value, a negative refund if your data has them.
| Row | Amount (D) | Expected F | Why this row |
|---|---|---|---|
| 2 | 100 | 110 | Plain case |
| 3 | 0 | 0 | Zero must not look blank |
| 4 | (empty) | (blank) | Edge case from the prompt |
| 5 | -20 | -22 | Refunds keep their sign |
Row 3 is a useful trap. A formula that tests IF(D3, ...) treats zero as false and shows a blank. The version above compares with "" and returns 0, which is what you want.
Step 3: Compare
Fill the formula down these rows and check each one against the Expected column. Use Sheets itself to compare rather than judging by eye. If your expected values are in column G, this flags mismatches:
=IF(F2=G2, "OK", "CHECK")Step 4: Check the references
Click the formula cell and look at the colored outlines Sheets draws around each referenced range. Confirm they cover the rows you intend. Two reference problems come up repeatedly:
- Relative references that drift.
D2:D50copied down becomesD3:D51. If the range should stay fixed, it needs$D$2:$D$50. - Closed ranges that miss new rows.
D2:D50ignores row 51. An open range such asD2:Dgrows with the data.
Checking summary formulas
Summary formulas are the easiest to get wrong because one number hides many rows. Check each one with an independent method.
Take the grocery total:
=SUMIF(B2:B, "Groceries", D2:D)Independent check 1: filter column B to Groceries, select the Amount cells, and read the sum in the bottom-right corner of Sheets. The filtered total should equal the formula result.
Independent check 2: count how many rows match, then judge whether the size is plausible:
=COUNTIF(B2:B, "Groceries")If the count is lower than you expect, look for variants such as groceries, Grocery, or Groceries with a trailing space. SUMIF ignores letter case but does not ignore extra spaces or different spellings. Fix the data with a find-and-replace, or clean the column with TRIM.
For QUERY, the grand total is the best check. The per-category totals must add up to the sum of the whole column:
=QUERY(A1:E, "select B, sum(D) where D is not null group by B label sum(D) 'Total'", 1)In a spare cell, compare:
=SUM(D2:D)If the QUERY totals add up to less than this number, rows were dropped. The usual cause is that some Category cells are empty, so those rows land in a blank group, or the header argument (the final 1) does not match your actual header rows.
For ARRAYFORMULA, check the first row, a middle row, and the last row of the spilled result, plus a blank row:
=ARRAYFORMULA(IF(D2:D="", "", D2:D*1.1))Also confirm the spill area is clear. If any cell below the formula holds a value, Sheets shows a #REF! error because the result cannot expand into an occupied cell.
Checking charts
A chart is a view of a range, so check three things.
- Data range. Open the chart editor and read the data range. Compare it with the range in your prompt, for example
A1:E50. - Series and axis. Confirm that the X-axis shows categories and the series shows the measure. A common slip is plotting Date as a series when it should be the axis.
- Totals. Compare a bar's height with a number you calculated. If the Groceries column should be 412.30, hover over it and confirm the value.
Also check that the chart reflects the grouping you asked for. Here is the prompt:
Create a column chart of total Amount by Category using the data in A1:E50, with the title "Spending by Category".The chart should have one column per Category, not one per row. If you see dozens of columns, the aggregation step did not happen. Ask Gemini to summarize first, or build a summary range with QUERY and chart that.
Watch for these misleading chart settings as well:
- A y-axis that does not start at zero, which exaggerates small differences.
- Truncated category labels that hide two categories with similar names.
- A "Total" row included in the data, which makes one column far taller than the others.
When the check fails
Do not assume the formula is the only problem. Look at the data first, because Gemini reads what is in the cells.
| Symptom | Likely cause | What to do |
|---|---|---|
| Total is lower than expected | Amounts stored as text | Compare `COUNT` and `COUNTA`, then convert to numbers |
| SUMIF returns 0 | Category spelling or spaces differ | Use `TRIM`, or fix the labels |
| `#REF!` from ARRAYFORMULA | Cells below are occupied | Clear the spill area |
| QUERY returns an error | Column letters or header count wrong | Check the header argument and the range |
| Chart has too many columns | Data was not grouped | Summarize first, then chart the summary |
When the cause is in the formula, return to the side panel and give a specific correction, such as "The formula in F3 returns blank when D3 is 0. It should return 0." A concrete description of the failing case works better than "it's wrong". The next chapter covers follow-up prompts in detail.
A short checklist
- I can state what the output does in my own words.
- I tested it on rows including an empty row and a zero.
- I compared it with a hand calculation or an independent method.
- The ranges cover all current rows and are open if the data will grow.
- Text-versus-number problems and spelling variants are ruled out.
- I applied it on a copy first when the sheet matters.
Exercise
Your formula =SUMIF(B2:B, "Groceries", D2:D) returns 180, but you expect about 300. Name two checks you can run and two likely causes.
Show answer
Checks: (1) filter column B to Groceries and read the sum of the selected Amount cells in the bottom-right corner, and (2) use =COUNTIF(B2:B, "Groceries") to see how many rows match. Likely causes: some Category labels differ in spelling or have trailing spaces, such as "Groceries " or "Grocery", so they do not match. Or some Amount values are stored as text, so SUMIF skips them. Compare COUNT(D2:D) with COUNTA(D2:D) to detect the text case.
Exercise
You asked for column F to show Amount plus 10% tax and blank when D is empty. Gemini wrote =IF(D2, D2*1.1, ""). Which test row exposes the problem, and what is the fix?
Show answer
A row where D is 0. The formula treats 0 as false, so it returns blank instead of 0. Use =IF(D2="", "", D2*1.1), which blanks only truly empty cells and returns 0 for a zero amount.
Exercise
A QUERY summary by Category shows totals that add up to 5,200, but =SUM(D2:D) returns 5,650. Give one probable cause and how you would confirm it.
Show answer
Some rows have an empty Category, so they fall into a blank group that is not shown or not counted as you expect. Confirm with =COUNTBLANK(B2:B) restricted to the data rows, or by filtering column B for blanks and summing their Amounts. Another possible cause is a wrong header argument in QUERY.