How to filter using multiple keywords in google sheets or excel - excel

I'm using google sheets, and I've been trying to filter data based on if the B value contains any of multiple keywords. I'm trying to sort account data, and the names aren't consistent, so I can't just say =FILTER(C:C,(B:B="BK's Stuff")+(B:B="Book")). I need something that will take information out of a lot of text like a wild card. What works great for a single entry is:
=FILTER(C:C,SEARCH("BK",B:B))
But I can't figure out how to combine it so it will filter all values that contain EITHER "BK" or "Book."
Thanks in advance.

You can do it replacing SEARCH through a combination of REGEXMATCH and ARRAYFORMULA
REGEXMATCH allows you to search for multiple keywords separated by |
Sample:
=FILTER(C:C,REGEXMATCH(B:B,"BK|book")=TRUE)
Note:
Regexp is case sensitive, so you need to specify separately
REGEXMATCH(B:B,"BK|bk|Bk|bK|") etc.

This is for Excel:
You can combine several SEARCH()s as follows:
=FILTER(C1:C20,ISNUMBER(SEARCH("Book",B1:B20,1))+ISNUMBER(SEARCH("BK",B1:B20,1)))
(should be similar for Google Sheets)

Related

How can I filter all values in a CSV spreadsheet that don't match one of hundreds of values from another spreadsheet?

I'm using Google Sheets and Google Collab together and trying to clean up the data I've downloaded as a CSV file. The problem I'm facing is that I want to filter out all results that don't match one of 100+ values one could have as group names which I've grabbed from another spreadsheet and currently have stored in an array. I think there are one or two other filters I'll want to apply, but the others only have four or five possible values in comparison.
I succeeded using Pandas isin()
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.isin.html
Specifically I used something like the example here:
titanic[titanic["Pclass"].isin([2, 3])]
I understand isin() provided you with booleans telling you whether an index is in the array. Using it like above turns it into a filter of sorts only keeping the items that match the items in the array.
https://pandas.pydata.org/docs/reference/api/pandas.Series.isin.html

How to search for items with multiple "-" in excel or VBA?

I have a list of item numbers (100K) like this:
Some of the items have format like SAG571A-244-4 (thousands) which need to be filtered so I can delete them and only keep the items that have ONE hyphen per SKU. How can I isolate the items that have two instances of "-" in it's SKU? I'm open to solutions within Excel or using VBA as well.
Native text filters don't seem to be capable of this. I'm stumped.
As per John Coleman's comment, "*-*-*" can be used to isolate strings that have at least two dashes in them.
I would add that if you're entering them as a custom text filter, you should lose the double quotes (so just *-*-*) as otherwise the field seems to interpret the quotes literally.
Seems to work for me.
If you want just an excel formula to verify this and give you a result of the number of hyphens (0, 1, or 2+), here is one:
=IF(ISERROR(SEARCH("-",A1)),"0",IF(ISERROR(SEARCH("-",A1,IFERROR(SEARCH("-",A1)+1,LEN(A1)))),"1","2+"))
Replace A1 with your relevant column, then fill down. This is kind of a terrible way to do this performance wise, but you avoid using VBA and possibly xlsm files.
The code first checks to see if there is one hyphen, then if there is it checks to see if there is another hyphen after the position the first one was found. Looking for multiple hyphens in this manner is cumbersome and I don't recommend it.

microsoft search using multiple criteria (wildcards, exclusions, etc.)

I am using a Microsoft DB application (AXAPTA) that lets us search various fields by typing criteria at the tops of the table. An example would be to filter item numbers to those starting with a 2 by typing 2* or excluding items with bell in the description by typing !bell. Quotes are not normally needed. We often combine multiple criteria by separating them with a "," For example, 2*,9* where the "," acts as an OR. Unfortunately, I cannot figure out how to create a multiple criteria AND. What I am trying to do is exclude items that have DNU in the description AND also have bell in the description.
My thought would be
!DNU & bell
but that doesn't work. Any ideas? I am sure this is simple, but I am stuck.
You need to use the advanced SQL query syntax, which can also be put in the filter location.
You'll have to play with it a while to get exactly what you want, but see these links below. You'll probably need to use a combination of info from the different links:
https://technet.microsoft.com/en-us/library/aa569937.aspx
http://www.axaptapedia.com/Expressions_in_query_ranges
https://msdn.microsoft.com/en-us/library/aa893981.aspx
https://learn.microsoft.com/en-us/dynamics365/unified-operations/fin-and-ops/get-started/advanced-filtering-query-options

Finding matching datasets in two separate spreadsheets (Excel/Pages)

Using Pages (or Excel) I'd like to do the following:
I have a list of around 150 order numbers in one spreadsheet (A).
In another spreadsheet (B) I have a database of all customers (thousands) including their order numbers and their email addresses.
I need to find a way to match the order numbers in (A) with the associated email addresses in (B), i.e. I need a list of all email addresses of the orders in list (A).
I'm not very good at Excel/Pages. Does anyone have an easy solution for this? Thank you!
This is a common =VLOOKUP scenario. Without knowing more about the specific details of what you need it's difficult to write something for you.
As you say you're not very experienced I would recommend using the Insert Function Wizard to put something together, have a look at this guide on how to create a vlookup formula through the wizard: http://www.howtogeek.com/howto/13780/using-vlookup-in-excel/

excel search for multiple items

I am trying to search for multiple items in a cell. If any of the terms I am looking for is present, I want cell D to display "Laptop", otherwise, display "Desktop". I can get the following to work, with just one term to search for:
=IFERROR(IF(SEARCH("blah",A2),"Laptop",""),"Desktop")
But I want to search for the presence of blah, blah2, and blah3. I don't know how to get Excel to search for any of the following terms. (Not all of them mind you, just any of the following.
I did see that there is an or option for the logic.
=OR(first condition, second condition, …, etc.)
I am not sure how to get these two to work together. Any thoughts on how to get them to display "Laptop" if any of the words are present?
This should work:
=IF(SUM(COUNTIF(A2,"*" &{"blah1";"blah2";"blah3"}& "*"))>0,"laptop","desktop")
You could use the combination of OR, IFERROR and SEARCH as you suggest, but I think the simpler construct would be ...
=IF(AND(ISERROR(SEARCH("value1",A2)),ISERROR(SEARCH("value2",A2))),"Desktop","Laptop")

Resources