76

I wish to create an Outlook rule that matches two non-adjacent words in the subject line. It must match both words (AND), not one or the other. If I add the two words as one entry it treats them as a phrase rather than two distinct words, and if I add them as separate entries, it places an "OR" between them. Creating two rules doesn't work either, as they behave just like the "OR" case.

Is there any way to say, in effect, "Apply this rule to emails matching ALL of the following words."?

2
  • 14
    As a work-around, I can add one word to "with xxx in the subject" and the other word to "with xxx in the subject or body". This isn't reliable, however, so I'd still like to know if a better solution exists. Sep 10, 2009 at 1:44
  • Sigh. I thought I had hit on something when I used the "with xxx in the subject" and "with xxx in the subject or body." It worked perfectly with one rule, not at all with any other rule. And then when I modified the rule it was working for, it stopped working on that one too...
    – Deacon
    Oct 21, 2015 at 18:16

9 Answers 9

43

I'm afraid the answer is no.

You can't change the logic from the Rules Wizard itself. It's preset for "usual" requests. I tested a few different wizard options for you though.

If you key in the whole phrase (instead of just one word at a time) as one submission (e.g. "How do you get there") it will filter any messages that comes through with all the words in that order. That helps (maybe!) but if you get a message that has, "how do you ALWAYS get there" it won't activate the filter so it might not meet your needs. If you already know the difference between the AND and OR controller then you probably already know that this won't help you ;)

As you've already discovered, if you drop each word in separately, it will use the "or" controller and you'll filter out a lot more messages than you want.

You CAN import custom scripts for your Outlook rules but you have to use VBScript and you have to craft the rules in VBScript for applications, not just the editor. It's proprietary to Microsoft Corp.

There is an expanding knowledge base article from Microsoft

It's got examples of code you can use but you have to draft it from VBScript for applications as mentioned above.

You might consider a third party filter.

Source

(This question has been asked many times and the conclusion is always the same.)

2
  • Wow, I had no idea you could write filters in VBA! That's perfect for me, thanks. Sep 10, 2009 at 5:00
  • 22
    Because of things like this in general, I am confused why everyone at Microsoft hasn't died from embarrassment yet. Dec 17, 2018 at 20:16
35

I found a way around this. If you use the rule "with specific words in the subject" and then also use the rule "with specific words in the subject or body" then you can link two phrases together that are both in the subject with the "and" operator.

6
  • 3
    The OP mentioned this exact workaround in a comment six years ago. Oct 15, 2015 at 20:57
  • 13
    It's a shame the OP didn't provide this workaround as an answer. I didn't see it in the chatter.
    – Rich
    Sep 6, 2016 at 17:33
  • 3
    This workaround didn't work reliably for the OP... Dec 19, 2016 at 13:35
  • 3
    Then if you get an email with the 1st word in Subject and the second in Body you sent the email to the wrong folder.
    – juanmf
    Mar 5, 2018 at 21:13
  • There also still or operator we get Aug 30, 2018 at 12:18
13

So, ehm, this is kind of ridiculous but it should work.

  1. Create a new temporary category
  2. Create a first rule that filters based on the first phrase and let it assign the temporary category (rule: assign it to the category category)
  3. Create a second rule that filters on the temporary category (rule: assigned to the category category) and on the next phrase and does the action you want to do
  4. Create a third rule that removes the temporary category (rule: clear message's categories) from all mail

Make sure the order is correct though, the first rule should execute first so put in top etc.

If you need more than 2 AND phrase matches you'll need another temporary category.

1
  • 1
    Not the ideal but it was a quite good approach without using VBA or third party filter.
    – Marco
    Jun 10, 2021 at 16:11
3

If you know one of the words won't be in the body, say the words are A and B and B is not in the body, you can do

with A in the subject
 and with B in the subject or body
do whatever
except if the body contains B
1

I couldn't find any other simpler way but found that you can use two keywords if you split them between the "in subject" and "in subject and body" conditions:

Two keywords in AND condition from subject line

1
  • 1
    Welcome to Super User! Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.
    – DavidPostill
    Nov 28, 2020 at 13:08
0

If one of the two words belongs to a predefined list of words, you can filter on it by creating an exception condition to exclude the other words of the predefined list.

0

I think only server rules have this restriction. If you create a local rule you can add multiple filters for the same field and make the rules be "all" or "any".

0

While it may not be possible to perform this logic within a 'Rule', you could create a 'Search Folder' to accomplish the same logic using the 'Query Builder'. You could then check this folder for matched emails and perform whatever action you need. See below for a screenshot showing a dummy search folder criteria similar to your original question.

If you don't have the 'Query Builder' enabled already (for some reason, it's hidden by default), then this link will guide you through the steps to enable it. Adding and using the Microsoft Query Builder

Query Builder

-1

You can use SQL filter. Here example of filtering all tasks which is not done, AND tasks completed in last 7 days:

http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/811c000b" = 0 OR %last7days("http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/810f0040")%
1
  • 1
    what's SQL filter and how to use it in Outlook? You need to include all the necessary information in the answer
    – phuclv
    Mar 22 at 2:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .