Outlook Search folder -- How to filter messages that have one category but don't have another?

I'm coming from a Google Apps setup at my old company to Outlook 2007 at my new company, and I'm trying to make it feel "more like home."

I plan to use Search Folders to handle my Status labels, but the kicker is that I also have a "Finished" category. So, if a message has the category "Next Action" but also has the Category "Finished", I would like it not to show up in the search folder.

Taking the Next Action category as an example, I set up a search folder with the following criteria:

  • Category --> is exactly "S/Next Action"
  • Category --> Doesn't Contain "Finished"

However, this filter seems to be an "or" filter, not an "and" filter. So, I am getting all messages with Next Action, but also all messages that don't have the "finished" category.

What's the best way to remedy this situation?


After some time, it appears I've found a solution for my specific situation for now.

The Simple Solution

Query wise, I know I can perform this search using:

category:("S/Next Action" NOT "S/Finished")

But in my case, the solution was a little bit simpler:

  • Create a new Search Folder
  • Under Criteria, in the "More Choices" tab, select "S/Next Action" from the categories list
  • In the "Advanced" tab, Select "Categories" for the field
  • Set the criteria to "Doesn't Contain"
  • Set the value to "S/Finished"

This solution works, but of course it would run into difficulty should the query ever need to grow more complex.

The More Powerful Solution

Thanks to this awesome article, I was able to figure it out. Below are the steps from the article:

Enabling QueryBuilder in Outlook 2007 via a Registry Hack

  • Run regedit in your run command or via Win + R
  • Navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\
    • If you have Outlook 2007 navigate to 12.0 folder
  • Right click on Outlook and Add a new key. Name it as QueryBuilder
  • Exit Registry editor.

Creating the Advanced Query

  1. In Outlook, select the "Tools" menu --> "Instant Search" --> "Advanced Find"
  2. Click the "Query Builder" tab (which did not exist before our registry hack)
  3. Define the first criteria
    • Field: "Categories"
    • Condition: "contains"
    • Value: "S/Next Action"
  4. Define the second criteria
    • Field: "Categories"
    • Condition: "Doesn't Contain"
    • Value: "S/Finished"
  5. Select the logical group
    • From the "Logical Group" drop-down, select "AND". This is key to making sure that Outlook enforces all the criteria (which is not normally the case; hence this post)
  6. Set the Scope to of the Search to the Desired Level
    • In the "Look for:" drop-down, select "Messages" (likely already selected)
    • Click "Browse"
    • Make sure all appropriate folders are selected (I chose the entire mailbox)
    • Check the "Search Subfolders" checkbox

Saving the Query as a Search Folder

  • In the Advanced Find window, click "File"
  • Click "Save as Search Folder" and name the Search Folder.

Success!

So, there we have it! Problem solved.


  • Right click Search Folders and select New Search Folder
  • Select Create a custom Search Folder
  • Click Criteria
  • On the More Choices tab, click Categories and select S/Next Action
  • On the Advanced tab, select Field > All Mail fields > Categories
  • Change Condition: to doesn't contain and enter "S/Finished" using quotation marks
  • If there are multiple categories you want to be excluded, put each in quotation marks and separate with spaces, e.g.: "Category A" "Category B"