How to Categorize Bank Transactions Automatically

Manually categorizing hundreds of transactions is tedious. Automatic categorization saves hours of work each month.


Why Categorize Transactions

Budgeting

See where money goes:

  • How much on groceries?
  • Dining out spending?
  • Subscription costs?

Tax Preparation

Identify deductible expenses:

  • Business expenses
  • Medical costs
  • Charitable donations

Financial Analysis

Track trends:

  • Category spending over time
  • Compare to previous months
  • Identify areas to cut

Category Structure

Common Personal Categories

CategoryExamples
IncomePayroll, interest, refunds
HousingRent, mortgage, repairs
UtilitiesElectric, gas, water, internet
GroceriesSupermarkets, grocery stores
DiningRestaurants, fast food, coffee
TransportationGas, parking, rideshare
ShoppingAmazon, retail stores
EntertainmentMovies, games, streaming
HealthcareDoctor, pharmacy, insurance
SubscriptionsNetflix, Spotify, software
TransfersBetween accounts
FeesBank fees, ATM fees
OtherUncategorized

Common Business Categories

CategoryExamples
RevenueClient payments, sales
PayrollSalaries, contractor payments
RentOffice space, equipment
UtilitiesBusiness phone, internet
SoftwareSaaS subscriptions
MarketingAds, promotions
TravelFlights, hotels, meals
Office SuppliesSupplies, equipment
Professional ServicesLegal, accounting
InsuranceBusiness insurance
TaxesTax payments

Method 1: Keyword Matching with VLOOKUP

Create Keyword Table

Build a lookup table on a separate sheet:

Keywords sheet:

KeywordCategory
PAYROLLIncome
DIRECT DEPIncome
AMAZONShopping
WALMARTGroceries
TARGETShopping
STARBUCKSDining
UBERTransportation
LYFTTransportation
NETFLIXSubscriptions
SPOTIFYSubscriptions
SHELLTransportation
EXXONTransportation

VLOOKUP Formula

Find matching keyword and return category:

=IFERROR(VLOOKUP("*"&$B2&"*",Keywords!$A:$B,2,FALSE),"Uncategorized")

Problem: VLOOKUP doesn't do partial matching directly.

=IFERROR(
  INDEX(Keywords!$B:$B,
    MATCH(TRUE,
      ISNUMBER(SEARCH(Keywords!$A:$A,$B2)),0)),
  "Uncategorized")

Enter as array formula (Ctrl+Shift+Enter) in older Excel.


Method 2: Nested IF Statements

Basic Structure

=IF(ISNUMBER(SEARCH("PAYROLL",B2)),"Income",
 IF(ISNUMBER(SEARCH("AMAZON",B2)),"Shopping",
 IF(ISNUMBER(SEARCH("STARBUCKS",B2)),"Dining",
 IF(ISNUMBER(SEARCH("SHELL",B2)),"Transportation",
 "Uncategorized"))))

Advantages

  • Simple to understand
  • Easy to modify
  • No separate lookup table needed

Disadvantages

  • Gets long with many keywords
  • Hard to maintain
  • Excel limits nesting depth (64 levels)

Method 3: SWITCH Function (Excel 2019+)

=SWITCH(TRUE,
  ISNUMBER(SEARCH("PAYROLL",B2)),"Income",
  ISNUMBER(SEARCH("AMAZON",B2)),"Shopping",
  ISNUMBER(SEARCH("STARBUCKS",B2)),"Dining",
  "Uncategorized")

Cleaner than nested IFs but same limitations.


Method 4: XLOOKUP with Wildcards (Excel 365)

=XLOOKUP("*"&"AMAZON"&"*",B:B,C:C,,"*")

Or search through keyword table:

=IFERROR(
  XLOOKUP(1,
    --ISNUMBER(SEARCH(Keywords!A:A,B2)),
    Keywords!B:B,
    "Uncategorized"),
  "Uncategorized")

Method 5: Google Sheets REGEXMATCH

=IF(REGEXMATCH(B2,"(?i)payroll|direct dep"),"Income",
 IF(REGEXMATCH(B2,"(?i)amazon|walmart|target"),"Shopping",
 IF(REGEXMATCH(B2,"(?i)starbucks|restaurant|grubhub"),"Dining",
 "Uncategorized")))

The (?i) makes it case-insensitive.

With Lookup Table

=IFERROR(
  FILTER(Keywords!B:B,
    REGEXMATCH(B2,Keywords!A:A)),
  "Uncategorized")

Building Your Keyword List

Start with Common Merchants

AMAZON → Shopping
WALMART → Groceries
TARGET → Shopping
COSTCO → Groceries
STARBUCKS → Dining
MCDONALD → Dining
UBER → Transportation
LYFT → Transportation
SHELL → Transportation
CHEVRON → Transportation

Add Your Specific Merchants

Review uncategorized transactions:

  • Landlord name → Housing
  • Employer name → Income
  • Local stores → Appropriate category

Handle Variations

Merchants appear differently:

AMAZON MKTPL
AMZN.COM
AMAZON PRIME
Amazon.com

Use partial keywords:

AMAZON → Shopping (catches all variations)

Handling Edge Cases

Same Merchant, Different Categories

Problem: Walmart could be Groceries or Shopping

Solutions:

  1. Use more specific categories
  2. Add secondary rules based on amount
  3. Default to most common use, fix exceptions manually

Transfers Between Accounts

Identify by:

  • Keywords: TRANSFER, XFER, MOBILE DEPOSIT
  • Matching amounts (in and out)
=IF(ISNUMBER(SEARCH("TRANSFER",B2)),"Transfer",...)

Income vs Expense

Use amount sign:

=IF(C2>0,
  IF(ISNUMBER(SEARCH("PAYROLL",B2)),"Salary","Other Income"),
  <expense categorization>)

Improving Accuracy Over Time

Track Uncategorized

Filter for "Uncategorized" category:

  1. Review descriptions
  2. Add new keywords to table
  3. Re-run categorization

Monthly Review Process

  1. Run auto-categorization
  2. Filter uncategorized
  3. Add 5-10 new keywords
  4. Re-run
  5. Spot-check results

Accuracy Tracking

=COUNTIF(D:D,"Uncategorized")/COUNTA(D:D)

Goal: Under 10% uncategorized.


Sample Complete Solution

Setup

Sheet 1: Transactions

DateDescriptionAmountCategory

Sheet 2: Keywords

KeywordCategory

Category Formula

In D2 of Transactions sheet:

=LET(
  desc,B2,
  keywords,Keywords!$A$2:$A$100,
  categories,Keywords!$B$2:$B$100,
  matches,ISNUMBER(SEARCH(keywords,desc)),
  result,FILTER(categories,matches,""),
  IF(result="","Uncategorized",INDEX(result,1))
)

(Excel 365 with LET function)

For Older Excel

=IFERROR(
  INDEX(Keywords!$B$2:$B$100,
    MATCH(TRUE,ISNUMBER(SEARCH(Keywords!$A$2:$A$100,B2)),0)),
  "Uncategorized")

Enter with Ctrl+Shift+Enter.


Summary

Automatic transaction categorization uses keyword matching to assign categories based on merchant names in descriptions. Build a keyword-to-category lookup table, then use formulas like INDEX/MATCH with SEARCH or nested IF statements. Start with common merchants, add your specific ones over time, and review uncategorized transactions monthly to improve accuracy. With a good keyword list, you can automatically categorize 80-90% of transactions, turning hours of manual work into minutes.

Sandra Vu

About Sandra Vu

Sandra Vu is the founder of Data River and a financial software engineer with experience building document processing systems for accounting platforms. After spending years helping accountants and bookkeepers at enterprise fintech companies, she built Data River to solve the recurring problem of converting bank statement PDFs to usable data—a task she saw teams struggle with monthly.

Sandra's background in financial software engineering gives her deep insight into how bank statements are structured, why they're difficult to parse programmatically, and what accuracy really means for financial reconciliation. She's particularly focused on the unique challenges of processing statements from different banks, each with their own formatting quirks and layouts.

At Data River, Sandra leads the technical development of AI-powered document processing specifically optimized for financial documents. Her experience spans building parsers for thousands of bank formats, working directly with accounting teams to understand their workflows, and designing systems that prioritize accuracy and data security in financial automation.