In Google Sheets, one QUERY formula can turn a long transaction list into a grouped summary of possibly tax-related spending. Keep your expenses on one sheet with a Yes or No flag, then let QUERY total the flagged rows by category. QUERY works in Google Sheets only. Excel users should use SUMIFS instead, and the sheet does not decide what counts for tax, so check the rules with an adviser.
How should the data sheet be laid out?
Name the first sheet Data. Put these headers in row 1 and entries below:
| Column | Header | Example |
|---|---|---|
| A | Date | 12/05/2026 |
| B | Payee | Bike repair shop |
| C | Category | Transport |
| D | Tax-related | Yes |
| E | Amount | 46.80 |
| F | Proof | Photo saved |
Amount is in column E and the flag is in column D. The summary formula refers to these by letter.
What is the QUERY formula?
On a second sheet, in cell A1, enter:
- =QUERY(Data!A2:F500, "select C, sum(E) where D = 'Yes' group by C order by sum(E) desc label sum(E) 'Total'", 0)
This selects the category and the sum of the amount, keeps only rows where the flag says Yes, groups by category and puts the biggest first. The final 0 means no header row in the data range, since you started at row 2. If your headers are included in the range, change it to 1.
QUERY uses the column letters in the quoted string, so if you add a column, check that letters still point to the right fields. For a total beneath the table, use =SUM(B1:B20) or whichever rows the result occupies.
Why does my formula show an error in my language settings?
Google Sheets follows your locale. In many European locales, the decimal mark is a comma and the argument separator in a formula is a semicolon, so the formula may need to read =QUERY(Data!A2:F500; "select C, sum(E) ..."; 0). If Sheets rejects the commas, replace them with semicolons between arguments, but leave the commas inside the quoted query text as they are. Amounts typed with a dot in a comma-locale sheet can turn into text, so enter 46,80 if that is how your sheet reads numbers.
What does the result look like?
| Category | Total flagged |
|---|---|
| Equipment | €740.00 |
| Transport | €286.80 |
| Courses | €450.00 |
| Phone | €192.00 |
| Total | €1,668.80 |
740 + 286.80 + 450 + 192 comes to 1,668.80. The numbers are invented for the example.
Do you need to check the proof column?
Yes. Add another formula to count flagged rows with no proof: =COUNTIFS(Data!D2:D500,"Yes",Data!F2:F500,""). It returns the number of Yes rows where the Proof cell is empty. Aim for zero before you send anything to your adviser.
What if you prefer Excel?
Excel has no QUERY function, but the same summary comes from SUMIFS, one cell per category: =SUMIFS($E$2:$E$500, $C$2:$C$500, $A2, $D$2:$D$500, "Yes"), where A2 holds the category name. In an Excel installed with a European language, the function names may be translated and the separator may be a semicolon, so use the formula wizard or check the translated name in your own language. Excel 365 users can also use a PivotTable: drag Category to Rows, Amount to Values and Tax-related to Filters, and set the filter to Yes.
Both routes give the same totals, so pick the one you can check most easily.
Before you share the sheet
- Set sharing to a named person with view access rather than anyone with the link.
- Check the date format matches what your adviser expects.
- Download a PDF copy of the summary tab.
- Keep the original file unchanged after sending.
SpendixAI is built around India and rupees and is not offered for euro records. If you do track Indian-rupee spending, its categories carry tax-deductible and ITC-eligible settings and its reports group totals by category.
Useful ideas start with a clearer picture of your own spending.
Explore your reports


