Creating Rules
Guide 24: Creating Rules
Build automatic categorization rules
Overview
Rules are the most reliable way to auto-categorize transactions. Create a rule once, and every matching transaction is categorized automatically—no AI guessing required.
What you'll learn:
- Creating categorization rules
- Rule conditions and actions
- Managing and organizing rules
- Testing and troubleshooting rules
Time required: 2-3 minutes per rule
Prerequisites
- Categories set up
- Some transactions to base rules on
Creating a Rule
Step 1: Open Rules
Go to Banking → Rules (or Settings → Rules)
Step 2: Create New Rule
- Click Add Rule
- Enter rule details:
[Screenshot: Add Rule form]
Step 3: Define Conditions
Payee Conditions:
| Condition | Example | Matches |
|---|---|---|
| Contains | "Starbucks" | "STARBUCKS #1234" |
| Starts with | "AMZN" | "AMZN MKTP US" |
| Equals | "Netflix" | Only "Netflix" exactly |
| Matches regex | "UBER.*TRIP" | "UBER TRIP 123" |
Amount Conditions:
| Condition | Example |
|---|---|
| Greater than | > $100 |
| Less than | < $10 |
| Between | $50 - $200 |
| Equals | = $9.99 |
Step 4: Set Actions
What happens when rule matches:
| Action | Description |
|---|---|
| Set Category | Assign category |
| Set Payee | Clean up payee name |
| Add Tag | Apply tag |
| Mark Business | Flag as business expense |
Step 5: Save Rule
Click Save
Rule Examples
Basic Examples
| Payee Condition | Category | Clean Payee |
|---|---|---|
| Contains "STARBUCKS" | Food:Coffee | Starbucks |
| Contains "NETFLIX" | Entertainment:Streaming | Netflix |
| Starts with "AMZN" | Shopping:Online | Amazon |
| Contains "UBER" AND < $50 | Transportation:Rideshare | Uber |
| Contains "SHELL" OR "EXXON" | Auto:Gas | (keep original) |
Advanced Examples
Multiple Conditions:
IF payee contains "UBER"
AND amount > $100
THEN category = "Travel:Transportation"
AND tag = "Business"
Rental Income:
IF payee contains "VENMO"
AND amount = $1200
THEN category = "Income:Rental"
AND payee = "Tenant Rent"
Rule Priority
Rules run in order from top to bottom. First matching rule wins.
Ordering Rules
- Go to Rules
- Drag rules to reorder
- More specific rules should be higher
Example Order:
- "AMAZON PRIME" → Subscriptions (specific)
- "AMAZON" → Shopping (general)
Creating Rules from Transactions
Quick Rule Creation
- Open a transaction
- Click Create Rule
- Rule pre-fills with transaction details
- Adjust conditions
- Save
Bulk Rule Creation
- Select similar transactions
- Right-click → Create Rule
- Rule based on common patterns
Managing Rules
View All Rules
Go to Banking → Rules:
| Rule | Condition | Category | Matches |
|---|---|---|---|
| Starbucks | Contains "STARBUCKS" | Food:Coffee | 47 |
| Netflix | Contains "NETFLIX" | Entertainment | 12 |
| Gas Stations | Contains "SHELL,EXXON,BP" | Auto:Gas | 28 |
Edit Rule
- Click rule name
- Click Edit
- Modify conditions/actions
- Save
Disable Rule
Without deleting:
- Click rule
- Toggle Enabled off
- Rule won't run but is preserved
Delete Rule
- Select rule
- Click Delete
- Confirm
Testing Rules
Test Before Saving
- In rule editor, click Test
- See which transactions would match
- Verify correct transactions selected
- Adjust conditions if needed
Apply to Existing Transactions
After creating a rule:
- Click Apply to Existing
- Choose date range
- Rule runs on matching transactions
Rule Conditions Reference
Text Matching
| Type | Syntax | Example |
|---|---|---|
| Contains | text | "coffee" matches "Coffee Shop" |
| Starts with | ^text | "^UBER" matches "UBER TRIP" |
| Ends with | text$ | "INC$" matches "ACME INC" |
| Exact match | =text | "=Netflix" matches only "Netflix" |
| Regex | /pattern/ | "/UBER.*\d+/" matches "UBER TRIP 123" |
Amount Matching
| Type | Syntax |
|---|---|
| Greater than | > 100 |
| Less than | < 50 |
| Equals | = 9.99 |
| Between | 50-200 |
Combining Conditions
| Operator | Meaning | Example |
|---|---|---|
| AND | Both must match | "UBER" AND > $50 |
| OR | Either matches | "SHELL" OR "EXXON" |
| NOT | Exclude | "AMAZON" NOT "PRIME" |
Tips & Best Practices
- Start broad, refine - Create general rules, add specifics as needed
- Use contains over equals - Bank names vary
- Test before applying - Preview matches first
- Order matters - Specific rules before general
- Review periodically - Remove outdated rules
- Document complex rules - Add notes explaining logic
Troubleshooting
Q: Rule not matching
A:
- Check for typos in condition
- Bank payee name may differ (check actual transaction)
- Rule might be disabled
- Higher-priority rule may be matching first
Q: Wrong transactions matching
A:
- Condition too broad
- Add more specific conditions
- Check for overlapping rules
Q: How many rules can I have?
A: Unlimited, but 50-100 well-designed rules usually cover most needs.
What's Next?
- Guide 23: AI Categorization - Let AI handle the rest
- Guide 6: Categories and Organization - Organize categories
Need help? Visit the OtterLedger community at github.com/openledger or check the FAQ.