Expense Sorted
|
By Fynn Schröder|expense-tracking|excel, categorization, automation, banking, tutorial, expense-tracking, formulas, microsoft-excel

You can categorize bank transactions in Excel by using formulas like SUMIFS or VLOOKUP to match descriptions to categories, or by using Power Query to automate the entire process from import to classification. This saves hours of manual sorting and gives you clean, ready-to-analyze spending data in minutes.

You can categorize bank transactions in Excel by using formulas like SUMIFS or VLOOKUP to match descriptions to categories, or by using Power Query to automate the entire process from import to classification. This saves hours of manual sorting and gives you clean, ready-to-analyze spending data in minutes.

You could spend the next 90 minutes categorizing each one. Or you could set up rules that do it automatically.

Excel has multiple tools for automatic categorization. Most people don't know they exist.

What's Your Emergency Fund Runway?

Calculate how many months of freedom you can afford right now

Example: $30,000 saved ÷ $3,000/month = 10 months of freedom

Let's learn how to implement them.

Method 1: VLOOKUP with a Merchant Lookup Table

This is the simplest approach and works for most situations.

The Setup

Create two sheets:

Sheet 1: "Transactions"

  • Column A: Date
  • Column B: Vendor/Merchant Name
  • Column C: Amount
  • Column D: Category (formula will populate this)

Sheet 2: "Lookup Table"

  • Column A: Merchant Name
  • Column B: Category

Populate the Lookup Table

List every merchant you recognize and its category:

MerchantCategory
STARBKSCoffee
WHOLE FOODSGroceries
TARGETShopping
SHELL GASTransportation
AWSSoftware

This is your rules engine. Every transaction matching "STARBKS" will get categorized as "Coffee."

The VLOOKUP Formula

In Sheet 1, Column D (Category), enter:

=IFERROR(VLOOKUP(B2, Lookup!A:B, 2, FALSE), "Uncategorized")

How it works:

  • VLOOKUP searches for the merchant name (B2) in your lookup table
  • If found, it returns the matching category from column 2
  • If not found, IFERROR displays "Uncategorized"
  • Copy this formula down for all transactions

Advantages:

  • Simple to understand and maintain
  • Fast (even for 10,000+ rows)
  • Easy to expand (just add merchants to the lookup table)

Disadvantages:

  • Merchant names must match exactly (STARBKS vs. STARBUCKS fails)
  • Doesn't handle partial matches or fuzzy matching
  • Requires you to build the lookup table manually

Method 2: INDEX-MATCH with Partial Text Matching

If merchant names vary slightly, use INDEX-MATCH with wildcards.

=IFERROR(INDEX(Lookup!B:B, MATCH("*" & B2 & "*", Lookup!A:A, 0)), "Uncategorized")

How it works:

  • MATCH searches for any cell containing the text from B2
  • The wildcard (*) matches partial strings
  • If "STARBKS COFFEE" appears in transactions but lookup has "STARBKS," it still matches

Advantages:

  • Handles variations in merchant names
  • More flexible than exact matching

Disadvantages:

  • Slower on large datasets (1000+ rows)
  • Partial matches can cause false positives ("TAR" matches both "TARGET" and "TARP RENTAL")

Method 3: Conditional Formatting with Rules

This approach categorizes based on simple rules rather than a lookup table.

Setup:

  1. Insert a new column for Category
  2. Use nested IF statements to apply rules

Example formula:

=IF(ISNUMBER(SEARCH("STARBKS", B2)), "Coffee", IF(ISNUMBER(SEARCH("WHOLE", B2)), "Groceries", IF(ISNUMBER(SEARCH("GAS", B2)), "Transportation", "Uncategorized")))

How it works:

  • SEARCH looks for specified text within the merchant name
  • IF evaluates conditions in order
  • First matching condition wins
  • Everything else gets "Uncategorized"

Advantages:

  • Handles partial matches
  • Easy to read and modify
  • No separate lookup table needed

Disadvantages:

  • Formula gets long and unwieldy quickly
  • Hard to maintain with many categories
  • Slow on very large datasets due to nested complexity

Method 4: Multi-Criteria Matching (Amount + Merchant)

Sometimes category depends on both merchant AND amount.

Example: A charge at "Target" for $5 is probably a quick purchase. A $200 charge at Target is probably bulk supplies.

=IF(AND(ISNUMBER(SEARCH("TARGET", B2)), C2 < 20), "Quick Purchases", IF(AND(ISNUMBER(SEARCH("TARGET", B2)), C2 >= 20), "Office Supplies", "Uncategorized"))

This categorizes based on both the merchant name and the amount.

Advantages:

  • More granular categorization
  • Closer to real-world logic

Disadvantages:

  • Complex formulas
  • Maintenance becomes tedious

Method 5: Helper Column with Date-Based Rules

For recurring payments, use date patterns.

Example: A weekly charge on Friday at a coffee shop is probably your standing order. A Monday charge might be a special trip.

=IF(AND(ISNUMBER(SEARCH("CAFE", B2)), WEEKDAY(A2) = 6), "Work Coffee", IF(ISNUMBER(SEARCH("CAFE", B2)), "Discretionary Coffee", "Other"))

WEEKDAY codes:

  • 1 = Sunday, 2 = Monday, … 6 = Friday, 7 = Saturday

Advantages:

  • Accounts for patterns you recognize
  • Useful for recurring expenses

Disadvantages:

  • Complex logic
  • Brittle (exceptions break the pattern)

Method 6: Excel Data Tools (Paid Tools Integration)

Excel 365 has experimental features for text analytics. Check if your subscription includes Power Query.

Power Query:

  • Import data
  • Load from URL or database
  • Use text matching and fuzzy matching
  • No formula required

This is the most flexible but requires Excel 365.

Additionally:

  • Power Pivot can use ML models (if you know Python)
  • Some third-party add-ins can connect Excel to ML categorization services

Step-by-Step Implementation (Practical Example)

Step 1: Export and Format

Export your bank statement as CSV. Open in Excel.

Columns:

  • A: Date
  • B: Merchant/Description
  • C: Amount
  • D: Category (empty, to be filled)

Step 2: Create Lookup Table (Sheet 2)

Sample data (you expand this):

MerchantCategory
STARBKSCoffee
WHOLE FOODSGroceries
AMAZONShopping
SHELL GASTransportation
AWS CHARGESoftware

Step 3: Enter the Formula

In cell D2, enter:

=IFERROR(VLOOKUP(B2, Lookup!A:B, 2, FALSE), "Uncategorized")

Step 4: Copy the Formula

Click D2. Copy (Ctrl+C). Select D3:D[last row]. Paste (Ctrl+V).

Excel applies the formula to all rows.

Step 5: Review and Update

Scan the "Uncategorized" transactions. Add new merchants to your lookup table as needed.

Recopy the formula. Excel will categorize the new merchants automatically.

Step 6: Refine Rules

If you notice systematic errors:

  • WHOLE FOODS in a different region shows as "WHOLE FDS." Add both variations to lookup table.
  • Transaction shows "Uncategorized" but should be categorized. Add the merchant to lookup.

After 1-2 refinement cycles, you'll hit 95%+ accuracy.

Handling Edge Cases

Mixed Transactions

You buy office supplies and snacks at Target. One transaction, two categories.

Solution:

  • Add a comment in the Amount column flagging the split
  • Manually split the row into two transactions
  • Or, categorize as "Office Supplies" (the primary category) and note the exception

Unrecognized Merchants

A vendor shows up once. You don't add them to the lookup table.

Solution:

  • These fall into "Uncategorized"
  • Review "Uncategorized" transactions monthly
  • Decide whether to add them to the lookup or leave them uncategorized

Recurring Transactions with Varying Names

Your internet provider sometimes charges as "ISP LLC," sometimes "Internet Services Inc."

Solution:

  • Use Method 2 (partial matching) with INDEX-MATCH
  • Or add both variations to the lookup table

Performance Considerations

Speed by Method:

  1. VLOOKUP: Fast (handles 10,000+ rows easily)
  2. INDEX-MATCH with wildcards: Slower (~1 second per 1,000 rows)
  3. Nested IF: Slowest with deep nesting (~2 seconds per 1,000 rows)

If you have 100,000 transactions, use VLOOKUP. If you have 1,000, any method works.

Maintenance Over Time

Your categorization strategy evolves:

  • You add new merchants
  • You refine categories (split "Shopping" into "Clothing" vs. "Household")
  • You catch patterns (e.g., every Tuesday = client lunch = deductible)

Best practice:

  • Review your lookup table quarterly
  • Add new merchants proactively
  • Update rules if your spending patterns shift

Method 7: Power Query for Fully Automated Categorization

Power Query (available in Excel 2016+ and Excel 365) takes automation further. Instead of formulas in cells, you build a repeatable data pipeline.

Why Power Query Is Different

With formulas, you apply categorization manually each time you add data. With Power Query, you define the logic once and refresh with one click — even when importing fresh CSV exports from your bank.

Setup Steps

Step 1: Import your bank CSV

  • Data tab → Get Data → From File → From Text/CSV
  • Select your bank export file
  • Click Transform Data (not Load) to open Power Query Editor

Step 2: Create a Categories reference query

  • Home → New Source → Enter Data
  • Build a two-column table: Merchant | Category
  • Name this query "Categories"

Step 3: Add a custom column for matching In your Transactions query, add a Custom Column:

= try Table.SelectRows(Categories, each Text.Contains([Merchant], [MerchantName]))[Category]{0} otherwise "Uncategorized"

Step 4: Load and refresh

  • Click Close & Load
  • Next month, just click Data → Refresh All

Power Query remembers every transformation. Add new merchants to the Categories table, refresh, and the entire history recategorizes instantly.

Advantages:

  • No formulas to copy and paste
  • One-click refresh every month
  • Works with multiple bank accounts (append queries together)
  • Handles 500,000+ rows without slowing Excel down

Disadvantages:

  • Steeper learning curve than VLOOKUP
  • Requires Excel 2016 or Excel 365
  • Power Query UI has quirks

Common Mistakes and How to Avoid Them

Mistake 1: Case-Sensitive Matching Failures

VLOOKUP is case-insensitive, but EXACT() and some custom functions are not. If your lookup table has "starbucks" and transactions show "STARBUCKS," most methods handle it fine — but always test with a few real rows before rolling out.

Fix: Use =LOWER(B2) in a helper column and match against a lowercase lookup table.

Mistake 2: Leading/Trailing Spaces

Banks often export merchant names with extra spaces. "STARBUCKS " (with trailing space) won't match "STARBUCKS."

Fix: Wrap your merchant reference in TRIM:

=IFERROR(VLOOKUP(TRIM(B2), Lookup!A:B, 2, FALSE), "Uncategorized")

Mistake 3: Not Accounting for Refunds

A refund from Amazon shows as a negative amount. Your lookup table categorizes it as "Shopping" — but it's actually income or a reimbursement.

Fix: Add a column for transaction type:

=IF(C2<0, "Refund", IFERROR(VLOOKUP(TRIM(B2), Lookup!A:B, 2, FALSE), "Uncategorized"))

Mistake 4: Lookup Table Gets Out of Sync

You move the Lookup sheet or rename it. All your formulas break.

Fix: Name your lookup range. Select the merchant+category columns in Sheet2, then Formulas → Define Name → "MerchantList." Update your VLOOKUP to reference the named range:

=IFERROR(VLOOKUP(TRIM(B2), MerchantList, 2, FALSE), "Uncategorized")

Building a Category Summary Dashboard

Once transactions are categorized, summarize them with SUMIF:

=SUMIF(D:D, "Groceries", C:C)

This totals all amounts where Category = "Groceries."

For a monthly breakdown, add SUMIFS with date criteria:

=SUMIFS(C:C, D:D, "Groceries", A:A, ">="&DATE(2026,1,1), A:A, "<="&DATE(2026,1,31))

Build a simple table with one row per category, and you have a live spending dashboard that updates every time you refresh data.

Bonus: Add a bar chart based on this summary table. Select the category and total columns → Insert → Bar Chart. Now you have a visual breakdown of your spending in under 60 seconds.

Practical Tips for Long-Term Maintenance

The hardest part of Excel categorization is keeping the lookup table current. Here's what works:

Weekly habit: After importing transactions, scan "Uncategorized" rows. If you see the same merchant twice, add it to the lookup table immediately.

Quarterly review: Check whether your categories still reflect your actual spending. Split a broad category (like "Shopping") into subcategories when one merchant dominates it.

Annual audit: Export 12 months of categorized data, run a pivot table by category, and compare to your budget. This highlights drift early.

Backup the lookup table: Save a copy of your lookup sheet as a separate workbook. If Excel corrupts the file, you lose the data but not the rules you spent time building.

Excel vs. Dedicated Expense Tracking Apps

Excel gives you control but requires setup. Dedicated apps give you automation but less flexibility.

FeatureExcelDedicated App
Setup time1–2 hoursMinutes
Ongoing maintenance5–15 min/monthNear zero
CustomizationUnlimitedLimited to built-in options
CostAlready included in Office$5–$15/month
Learning curveMediumLow
Multi-accountPossible (complex)Built-in

For a deeper comparison, see AI-Powered Bank Transaction Categorization — which covers what machine learning does that Excel can't.

If you want a Google Sheets alternative to these Excel methods, see the Google Sheets Expense Tracker Template Guide for a ready-to-use setup.

When to Upgrade Beyond Excel

If you're doing this:

  • 100,000+ transactions per year
  • Multiple accounts to consolidate
  • Complex tax categorization needs
  • Want machine learning (it learns from corrections)
  • Need multi-user access or accountant sharing

Then consider dedicated tools (Wave, YNAB, Expensify, or AI-powered expense categorization apps). They automate what Excel requires manual setup for — but Excel remains the best tool when you want full control over your data.

For business use cases with reporting requirements, see Automated Expense Reporting Setup and Best Practices.

Quick Wins

Tonight:

  1. Export one month of transactions
  2. List your top 10 merchants in the lookup table
  3. Enter the VLOOKUP formula
  4. Copy it to all rows
  5. Review and add any missing merchants

30 minutes of setup. Then every month, that formula handles 95%+ of categorization automatically.

For a complete picture of your expense workflows — from import through insights — see the Complete Expense Tracking Workflow and the Business Expense Tracker Guide.

That's Excel working for you instead of you working with Excel.

Let it do the heavy lifting.


How to Auto Categorize Bank Transactions in Excel: 6 Methods (2026)

Excel and Spreadsheet Guides:

AI and Automation Alternatives:

Business and Expense Tracking:

Complete Workflows:

complete bank transaction categorization guide

Google Sheets expense tracker template

Expertise: Written by Fynn Schröder, Founder of Treasure Island and Excel automation specialist with 10+ years of experience building spreadsheet solutions for finance and accounting workflows.


Want to skip the setup? Try ExpenseSorted to automatically categorize your bank transactions in seconds—no Excel formulas required.

Frequently Asked Questions

How do I automatically categorize bank transactions in Excel?

Use VLOOKUP or INDEX-MATCH formulas with a merchant lookup table, or Power Query to apply rules during import.

Can Excel categorize transactions from CSV files?

Yes, Power Query can import CSV files and automatically categorize transactions using conditional rules and lookup tables.

What Excel formula is best for categorizing expenses?

VLOOKUP with IFERROR is best for exact matches, while INDEX-MATCH with wildcards handles partial merchant names.

How do I create a bank transaction categorization template in Excel?

Create a Transactions sheet and a Lookup Table sheet with merchant names mapped to categories, then use formulas to match them.

Can Power Query auto categorize bank transactions?

Yes, Power Query can import transaction data and apply conditional rules to categorize entries automatically without manual formulas.

References