How to Categorize Data in Excel (Formulas, Keyword Rules and AI)
To categorize data in Excel, use a lookup table: number ranges with XLOOKUP, or a keyword list where SEARCH finds a word in each row and returns its category. Keyword rules are free and exact, but every new wording needs a new rule, and short keywords put rows in the wrong place. For messy text like bank lines, AI can pick a category from your own list instead.
Table of contents
Choose a method
It depends on what decides the category. If a number decides it, such as an amount or an age, use a range table. If a word in the text decides it, use IF with SEARCH for a few categories or a keyword table for many. If the meaning of the text decides it, formulas run out and AI helps.
| Your data | Example | Method |
|---|---|---|
| Numbers into bands | Order size: small, medium, large | XLOOKUP with a range table |
| Text, 2 to 5 categories | Tickets containing “refund” or “login” | IFS with SEARCH |
| Text, many categories | Bank lines to a chart of accounts | Keyword table |
| Text where the same word means different things | UBER *TRIP is travel, UBER *EATS is a meal | A more specific keyword, or AI |
| Free text with no fixed words | Customer comments, survey answers | AI with your own category list |
The running example is a month of business bank transactions, to be booked to a chart of accounts with account numbers. The lines are messy, with store numbers, reference codes and abbreviations like FACEBK *ADS 7G2KL9.
Numbers into ranges
Make a small table with the lower limit of each band and its name, sorted from smallest to largest. Then use XLOOKUP with match mode -1, which returns the band for the largest limit that is not above the number. One formula covers every band.
| From | Band |
|---|---|
| 0 | Small |
| 100 | Medium |
| 1000 | Large |
=XLOOKUP(ABS(C2), Bands!$A$2:$A$4, Bands!$B$2:$B$4, "", -1)
ABS turns a payment of -212.37 into 212.37 first, so outgoing amounts land in the right band. In older Excel, =VLOOKUP(ABS(C2), Bands!$A$2:$B$4, 2, TRUE) does the same, as long as the table is sorted. Age groups, price tiers and grades all work this way. Change a limit in the table, and every row moves with it.
Text with IFS and SEARCH
SEARCH returns the position of a word inside a text, or an error when the word is not there. Wrap it in ISNUMBER to get TRUE or FALSE, and use IFS to return a category for the first word that is found. It works well for up to about five categories.
=IFS(ISNUMBER(SEARCH("uber", B2)), "Travel",
ISNUMBER(SEARCH("starbucks", B2)), "Meals",
ISNUMBER(SEARCH("adobe", B2)), "Software and subscriptions",
TRUE, "Uncategorized")
SEARCH ignores upper and lower case. Use FIND if case matters. The last pair, TRUE, "Uncategorized", catches every row nothing else matched, so you get a label instead of #N/A. IFS needs Excel 2019 or later. In older versions, nest IF functions the same way.
Past five categories the formula gets long, and changing a rule means editing a formula in every row. That is when a keyword table is better.
Text with a keyword table
Put your keywords in one column and their category next to them. A single formula then checks every keyword against the row and returns the category of the first keyword it finds. To add a rule, you add a row to the table. The formula stays the same.
In Excel 2021 and Microsoft 365, this is the formula from the video, with a fallback label added. It searches the description in B4 for every keyword at once:
=XLOOKUP(TRUE, ISNUMBER(SEARCH(Keywords!$A$4:$A$18, B4)), Keywords!$B$4:$B$18, "Uncategorized")

For Excel 2010 and later, including Excel for Mac and the web, this version works without XLOOKUP. It is the formula in my template below:
=IFERROR(INDEX(Rules!$B$2:$B$200,
MATCH(TRUE, INDEX(ISNUMBER(SEARCH(Rules!$A$2:$A$200, B2))*(Rules!$A$2:$A$200<>"")>0, 0), 0)),
"Uncategorized")
The part (Rules!$A$2:$A$200<>"") matters. SEARCH finds an empty keyword in every text, so without it, a blank row in the rule table would match everything.
Both formulas return the first keyword in the list that matches, so the order of the table is your priority. Put specific keywords above general ones: UBER *EATS for Meals above UBER for Travel, and GOOGLE *ADS for Advertising above GOOGLE for Software. In SEARCH the asterisk is a wildcard, so UBER *EATS means UBER, then anything, then EATS. With that order and about 40 rules, my template sorts 44 of the 47 sample lines.
For a second column with the account number, look up the category in your chart of accounts with a normal XLOOKUP or INDEX and MATCH.
Where keyword rules fail
A keyword only knows its letters. It cannot tell an Uber ride from an Uber Eats lunch, or Google Workspace from Google Ads. It also finds nothing for a vendor you have not written a rule for yet, so the list needs new keywords every month.
In the video, the keyword list has 15 entries, one per vendor. Here is what happened on the September statement:
- Most lines return #N/A. Every vendor without its own keyword, such as Zelle rent, OpenAI, Canva, Lyft or the CPA, is not categorized.
- Uber Eats is booked as Travel, because it contains UBER.
- Amazon Web Services is booked as Office supplies, because the AMAZON rule was written for office orders.
- Google Ads is booked as Software, like Google Workspace.
The wrong rows are the bigger problem. An #N/A is easy to filter. A wrong category looks like every right one. Short keywords make it worse: a rule for IRS also matches FIRST, and RENT matches PARENT and CURRENT. You can fix each case with a longer keyword and better order, and for a stable set of vendors that is a good, free solution. It does not fix next month’s new vendor.
Categorize with AI
Give an AI model your rows and your own category list, and let it pick one category per row, or Other when none fits. Restricting it to your list matters: then it cannot invent a category, and a doubtful row gets a low confidence instead of a confident guess.
I built the AI Categorizer add-in for exactly this. It works in Excel on Windows, Mac and the web. These are the steps on the bank lines.
-
Pick the rows. Click inside your transactions and click Use selection as rows. Under Sort by these columns, tick only the description. Amounts and dates stay in your workbook.
-
Pick the categories. Click inside your chart of accounts and click Use selection as categories. Choose the Category name column. A Description column is optional and helps when two accounts are close. Under Copy these columns next to your rows, tick the account number. You can also type the categories in the pane, or start from a template, with Type them.


-
Check the cost and run. A question is optional, for example which P&L account a line belongs to. Click Check credits and run. The pane shows how many credits the run uses before anything is sent. One credit is one row, and repeated rows are free, like the payroll that comes twice a month.
-
Read the results. New columns appear next to your rows: Category, Confidence, Status and the account number.

Compare the keyword column with the AI columns. Uber Eats is in Meals, the Uber rides are in Travel, Amazon Web Services is in Software and subscriptions, and Google Ads is in Advertising and marketing. The transfer to savings, the owner draw and the IRS tax payment are not business expenses, so they come back as Other instead of a wrong account.
Two rows are marked Review: an Amazon Marketplace order, which could be almost anything, and a Uline order, which could be shipping supplies or packaging. The summary at the bottom of the pane counts them, and Show review rows filters your list to just those.

Next month, add the new lines below the list and run it again. Rows that already have a result are skipped, so you only pay for the new ones. The same works for any text: in the video I also sort customer comments into topics, and the question about a store in Berlin comes back as Other. Every install comes with 100 free credits, and a run can hold up to 50,000 rows.
Only the columns you tick, your category names, their descriptions and your question are sent to the service. Your data is not stored and not used to train AI models. If your policy allows no outside service, keep using the keyword formulas. Many people do both: rules for the clear cases, AI for the rest. My guide to writing categories that work explains how to name categories so the AI and the people reading the report agree.
Total per category
Use SUMIFS with the category column as the condition, or a PivotTable with the category in Rows and the amount in Values. Both update when you change a category. A COUNTIFS next to it shows how many lines each total is made of.
=SUMIFS(Transactions!$C$2:$C$1000, Transactions!$D$2:$D$1000, A2)
Add a row for Uncategorized or Other to the summary. If its total is large, your rules or your category list are missing something. For a monthly report, a chart of the totals by category is the natural next step. My guide to Excel dashboard add-ins covers turning those totals into a variance chart.
Keyword rule template
The template has the bank lines from the video, about 40 keyword rules in priority order, the chart of accounts and a summary by category. Paste in your own export and adjust the rules.
Categorize data in Excel: keyword rule template
A keyword table that books bank lines to a chart of accounts with one formula, with specific rules above general ones, account numbers and a SUMIFS summary. Three lines are left Uncategorized on purpose, to show where rules stop.
FAQ
How do I categorize data in Excel using VLOOKUP?
VLOOKUP works for number ranges with TRUE as the last argument and a sorted table. For text, VLOOKUP can only find a whole cell or a wildcard pattern, not a list of keywords inside one cell, so the SEARCH-based formulas above are the better fit.
How do I categorize data with a drop-down list?
For categories you assign by hand, select the category column, go to Data, Data Validation, choose List, and point the source at your category names. Everyone then picks from the same spelling, which keeps SUMIFS and PivotTables correct.
Can Excel categorize data automatically without formulas?
Power Query can add a conditional column, which is a point-and-click version of IFS: “if Description contains UBER then Travel”. It runs again on every refresh. For text that no rule describes well, an AI tool that only answers with your list, or Other, is the automatic option.
Sort bank lines, comments or any text rows into your own categories. Every row gets one of your categories or Other, never a made-up one, with a confidence and a Review flag for the doubtful ones. Every install comes with 100 free credits.
