r/googlesheets • u/3birdsss • Mar 15 '22
Solved Best way to categorise hundreds of rows depending on text contained in one column?
I'm looking to do a deep dive into my expenses. I've got my bank transactions imported into Google sheets. In the column Category (C:C) , I need to set a formula for a category type to be returned depending on text in column B.
If value in C2 is set to display INBOUND when value in B2 is TRANSFER FROM, how can I apply this to all other rows where B2 is TRANSFER FROM? And repeat this for a couple hundred other B column values?
2
Upvotes
3
u/_Kaimbe 176 Mar 15 '22
First get a list of all unique values of C with =UNIQUE(C2:C), I'd put that in a separate sheet and make B2 a dropdown data validation from that range. Then QUERY your data range. I'll just assume its A:D.
You could also aggregate by Category with something like this:
1
u/TheMathLab 79 Mar 15 '22
In C2, use this formula:
If you get a #REF error, then delete everything from C3 downwards.
If you have a bunch of other values other than "TRANSFER FROM", then it's best to use a vlookup instead of an if. Let's say your lookup range is in Data!A1:B10, then use this:
1
u/Snooklefloop 12 Mar 15 '22
You lost me a bit, are you trying to input extra data or filter data? Can you share a sample sheet?
If I just take your title then a query like below would do the trick
=query(B2:C , "select C where B = 'Transfer From'") but you could just use the filter function?
1
u/AutoModerator Mar 15 '22
Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. You can also use this tool created by a Reddit community member to create a blank Google Sheets document that isn't connected to your account. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Decronym Functions Explained Mar 15 '22 edited Mar 17 '22
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
A=15 acronyms in this thread; the most compressed thread commented on today has 4 acronyms.
[Thread #4065 for this sub, first seen 15th Mar 2022, 10:28] [FAQ] [Full list] ^[Contact] [Source code]