Categorizing rows by their contents in Numbers

Hi all,


I'm trying to use Numbers for personal budgeting by importing bank account and credit card statements and then categorizing transactions (one per row) like "travel", "housing", "food", etc.. There are formulas all over the internet for Excel but I don't seem to be able to do the same in Numbers (I'm an intermediate level spreadsheet wrangler).


Given a worksheet like this (a simplified version of the problem) I want to have Transactions/Category to be automatically filled in with the first matching category from Rules. Eg. if Description contains "GrocaryChain1" the transaction category should be "Food". Any ideas if this is doable in Numbers?


Thanks!


MacBook Pro 13", macOS 10.14

Posted on Mar 4, 2019 2:23 PM

Reply
5 replies

Mar 5, 2019 2:04 AM in response to Barry

@Barry Good catch, Transaction #3 is a typo. Here is a fixed version hared on iCloud:

https://www.icloud.com/numbers/0He-GTTqnhVnj_Vg9namyEwxg#Categorization_Problem


"if you used separate columns to record the vender and the payment method"

You are right, but the reality is, this comes from my bank account statement in which for most of the transactions the only usable column is the description. This description is usually a combination of vendor, payment method, place, time transaction id in an unpredictable way. My strategy is to have a set of rules that find keywords (eg. vendor names) in these descriptions to automatically identify the category for most transactions.


@SGIII


"What specific solutions have you found for Excel?"

I found this for Excel to be useful:

https://superuser.com/questions/1177565/how-do-i-use-excel-to-categorize-bank-transactions-into-easily-understandable-ca


I even made it work in Google Sheets (as I don't have Excel):

https://docs.google.com/spreadsheets/d/1sP5YvMvIE1Q-2jdQ4MI6A8Ceqft_ZGlWatv_0lW-ueE/edit?usp=sharing


"How many categories do you have?"

I guess I will have 20-30 rules matching descriptions to maybe 10-15 categories.




Mar 5, 2019 6:25 AM in response to salomvary

I see. As you of course have already discovered that "array formula" flavor of SUMPRODUCT doesn't work in Numbers.


A formula solution in Numbers would likely requires extra columns, one for each of your rules.


For example, for 5 rules you could do something like this:




The formula in B2, filled down:


=INDEX(C$1:G$1,MATCH(1,$C3:$G3,0))


The formula in C2, filled down and right.


=COUNTIFS($A3,C$2)


The rules are laid out in rows 1 and 2. The * before and after the values in row 2 are "wildcards" for COUNTIF, so that text can occur before and/or after in the cell in column A.


The COUNTIF returns 1 if it finds the value in row 2 in the corresponding cell in column A.


The INDEX MATCH combination is a lookup. The MATCH returns the position of the matching cell in the range. The INDEX retrieves the corresponding value from row 1.


Simply extend the range in the formulas as you add more rules.


If you end up having many more rules a script approach would work.


SG



Mar 5, 2019 12:29 AM in response to salomvary

The first thing I would suggest is a better match between the "Rule" column on the Rules table and the Description column on the Transactions table. I see NO match for Transaction #3.


The task of assigning categories to transactions would be simplified if you used separate columns to record the vender and the payment method.


Regards,

Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Categorizing rows by their contents in Numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.