If you track a business (or several) in spreadsheets, you can get most of the benefit of accounting software's bank rules with one formula and a small table. Paste in a statement, and every transaction gets a category; add a pivot table, and you have spending by category and month.
Download the categorization template (.xlsx)
The template has two sheets: Transactions (date, description, amount, category) and Rules (keyword, category). The examples below use its sample data.
Step 1: Get the transactions into one clean list
You need one row per transaction with a date, the bank's description and a signed amount (money in positive, money out negative). If you're starting from a PDF, see how to convert a bank statement to Excel, and run the balance check before you categorize.
Step 2: Build the rules table
On a sheet named Rules, list keywords that appear in descriptions and the category each one means:
| Keyword (contains) | Category |
|---|---|
| UBER *EATS | Meals |
| UBER | Car and truck |
| SQUARE INC | Sales |
| GUSTO | Payroll |
| SYSCO | Cost of goods sold |
| PG&E | Utilities |
| AMZN | Office supplies |
| ADOBE | Software |
| SPOTIFY | Owner's draw |
| SHELL | Car and truck |
Keywords are matched anywhere in the description and aren't case-sensitive. Order matters: the formula returns the first rule that matches, so "UBER *EATS" must come before "UBER". For choosing the categories themselves, use how to categorize business expenses.
Step 3: The formula
Excel 365 and Google Sheets
In the Category column (D2), assuming descriptions are in column B:
=XLOOKUP(TRUE, ISNUMBER(SEARCH(Rules!$A$2:$A$100, B2)), Rules!$B$2:$B$100, "Uncategorized")
How it works: SEARCH looks for every keyword inside the description at once and returns a position or an error. ISNUMBER turns that into TRUE for matches. XLOOKUP returns the category for the first TRUE, or "Uncategorized" if nothing matched. Fill it down the column.
Older Excel versions
Without XLOOKUP, use INDEX and MATCH (this is what the template uses, so it works everywhere):
=IFERROR(INDEX(Rules!$B$2:$B$100,
MATCH(TRUE, INDEX(ISNUMBER(SEARCH(Rules!$A$2:$A$100, B2)) * (Rules!$A$2:$A$100<>"") > 0, 0), 0)),
"Uncategorized")
The (Rules!$A$2:$A$100<>"") part stops empty rows in the rules table from matching everything.
Step 4: Review the leftovers
Filter the Category column for Uncategorized. For each one, decide the category and, if the payee will come back, add a rule. After two or three months, almost everything categorizes itself. Anything you're unsure about can go to an "Ask my accountant" category for now.
Step 5: Turn it into a monthly P&L
- Add a Month column:
=TEXT(A2, "yyyy-mm"). - Select the table and choose Insert → PivotTable.
- Drag Category to Rows, Month to Columns, and Amount to Values (Sum).
- Sort categories by total, or group income categories at the top.
Using Ortiz Catering's October sample data, the pivot looks like this:
| Category | 2026-10 |
|---|---|
| Sales | 3,482.15 |
| Rent or lease | −2,400.00 |
| Payroll | −1,840.00 |
| Cost of goods sold | −1,276.38 |
| Utilities | −412.67 |
| Office supplies | −84.99 |
| Car and truck | −63.21 |
| Software | −59.99 |
| Owner's draw | −11.99 |
Owner's draw isn't an expense, so leave it out of profit. Filter it out of the pivot, or keep it in a separate section. See owner's draw vs salary for why.
Common problems
| Problem | Fix |
|---|---|
| Everything returns "Uncategorized" | Check the sheet name in the formula matches your rules sheet exactly |
| Wrong category for some rows | A general keyword sits above a specific one; reorder the rules |
| #SPILL! in Excel 365 | Something is in the cells below the formula; clear them, or the column isn't a table |
| Formula is slow | Limit ranges to the rows you use (A2:A200), not whole columns |
| Transfers counted as income | Add rules for "TRANSFER", "ONLINE TRANSFER" and your card autopay, categorized as Transfer |
Bankly categorizes statements as it reads them, and learns from your corrections the same way a rules table does: change a payee once and it's filed that way on every statement after. When you're ready to move off spreadsheets, it syncs to QuickBooks Online.
Next: once each month is categorized, reconcile it, and make both part of your month-end close.