I’m a total spreadsheet nerd, so I had my personal finance spreadsheet hooked into tiller’s data sources pretty quickly, but thought I could do some tweaks to make it more universally useful and simple to set up.
My sheet is similar to other short term forecasting methods, but I’m trying to reduce the manual entries.
I’m struggling a bit on the error handling end.
I’ve got a cascade of queries and calculations, don’t want to overdo the details but:
- Items Query
- Gets items from the past year from Transactions
- Has a formula to strip out some of the random junk to make two similar entries have a repeatable (but less readable) key.
- Has a vlookup for the account type from Accounts sheet.
- Repeats Query
- Groups the items and determines an interval
That part all works fine. The SWE in me wants to write a macro for the iterative bit, but the coding standard around here seems to be to do it all in the sheet itself. So I have 5 columns generated by
=ARRAYFORMULA(if(ISNUMBER($Y6:$Y), $W6:$W+$Y6:$Y*Z5:AD5,""))
Sample Output:
| avg | min | max | count | Days Interval | 1 | 2 | 3 | 4 | 5 | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| spectrumspectrum–ppd | Checking | CHECKING | $ (59.99) | 4/10/2026 | 6/10/2026 | 3 | 30.50 | 7/10/2026 | 8/10/2026 | 9/9/2026 | 10/10/2026 | 11/9/2026 |
| afvpayendingin | Discover More Card | CREDIT | $ (3.34) | 6/2/2026 | 6/9/2026 | 5 | 1.75 | 6/10/2026 | 6/12/2026 | 6/14/2026 | 6/16/2026 | 6/17/2026 |
This is resilient to additional columns being inserted/deleted between the first and last column, Arrayformula is perfectly happy to cross those two results.
The next bit is tricky and I hope there’s a better way than what I’m doing.
I dynamically generate the queries to be run, this list auto expands/shrinks if the number of columns changes:
| Queries |
|---|
| Select R, T, S, U, Z WHERE Z < date ‘2026-07-14’ AND X > 2 |
| Select R, T, S, U, AA WHERE AA < date ‘2026-07-14’ AND X > 2 |
| Select R, T, S, U, AB WHERE AB < date ‘2026-07-14’ AND X > 2 |
| Select R, T, S, U, AC WHERE AC < date ‘2026-07-14’ AND X > 2 |
| Select R, T, S, U, AD WHERE AD < date ‘2026-07-14’ AND X > 2 |
Now I should be on the home stretch, this works great:
=Sort({Query(R6:AC525, AJ4,1);QUERY(R6:AC525, AJ5,1)}, 2, true,3, true, 5, true)
Sample Output:
| Description | Account Type | Account | Amount | Due |
|---|---|---|---|---|
| spectrumspectrum–ppd | CHECKING | Checking | $ (59.99) | 7/10/2026 |
| afvpayendingin | CREDIT | Discover More Card | $ (3.34) | 6/10/2026 |
| afvpayendingin | CREDIT | Discover More Card | $ (3.34) | 6/12/2026 |
But:
- I have to manually add all the queries, it’s not resilient to the number of repeats being changed.
- If I include enough repeat date columns to ensure we always have all the repeats, sometimes some of the queries are empty results, and the whole thing breaks.
- I’ve tried using iferror and I keep getting different sorts of problems with arrays not matching.
No additional error handling, non-query row included: Error
In ARRAY_LITERAL, an Array Literal was missing values for one or more rows.
Added is blank query error handling:
=Sort({Query(R6:AC525, AJ4,1);if(isBlank(AJ10),{"","","","",""}, QUERY(R6:AC525, AJ10,1))}, 2, true,3, true, 5, true)
In ARRAY_LITERAL, an Array Literal was missing values for one or more rows.
Same result with:
=Sort({Query(R6:AC525, AJ4,1);IFERROR(QUERY(R6:AC525, AJ10,1),{"","","","",""})}, 2, true,3, true, 5, true)
I could live with a fixed set of repeat columns, it’s more intended to catch the cable bill and the paychecks than the daily vending machine habit. I’ll have to add on to this later for annual items you might want to manually enter. But the bit about blank rows not working is really bugging me.
I shouldn’t be surprised if there’s not an easy solution for this, even SQL makes you manually list the unpivoted columns.