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

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

Related

How to find first unique value in a column of SKU?

So I have two columns, A & B, (like below). There's 2 components to the ID, the design (CEN101A) and the size (-6).
I'm trying find the first item of each design. So in this example, I would highlight (CEN106A-6, CEN101B-6, CEN101D-6, etc.). This is so I can use them as a parent for the other sizes.
I've tried many in-built functions but nothing seems to work. Is VBA able to easily find these values?
#BigBen is right, this is fairly easy if you can find what the actual design code is. For good measure I'd use a running count and add the hyphen back including a wildcard into the COUNTIF():
Formula for conditional formatting rule on range A2:A7:
=COUNTIF(A$2:A2,#TEXTSPLIT(A2,"-")&"-*")=1
Without TEXTSPLIT(), use a combo of LEFT() and FIND() as per the comment by #P.b:
=COUNTIF(A$2:A2,LEFT(A2,FIND("-",A2))&"*")=1

How to filter using multiple keywords in google sheets or 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)

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.

excel vba Delete entire row if cell contains the GREP search

I have a single column of text in Excel that is to be used for translating into foreign languages. The text is automatically generated from an InDesign File. I would like to clean it up for the translator by removing rows that simply contain a number ("20", 34.5" etc), or if they contain a measurement "5mm", "3.5 µm", etc. I've found many posts (see link below) on how to remove a row with specific string, but none that use search strings, such as those I typically use with GREP searches: "\d+" and "\d.\d µm"
How would I do this? I am on Mac iOS if that helps.
Note that I would need to delete the row if the cell only contains a number or a measurement, not if the number is contained within a phrase, sentence, or paragraph, etc.
https://stackoverflow.com/a/30569969
It may not be what you are looking for, but how about just sorting the column and remove the rows starting with numbers? It is a manual approach but from what I understand this translation process only happens from time to time. Am I right?
I see two possible issues in your question:
How to work with regular expressions in Excel?
How to delete rows in a loop?
Let me start with the second question: when you want to create a for-loop in order to remove items from a list, you MUST start at the end and go back to the beginning (it's a beginner's trick, but a lot of people trip over it.
About the first question: this is a very useful post about this subject, it's too large to even give a summary here.

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