Boolean search with multiple criteria in Outlook (AND and OR statements)

For the longest time, I’ve been using Advanced Find and enabled its Query Builder to perform searches with multiple criteria and Boolean statements.

This works quite well but it can sometimes be slow to set up such a search within the Advanced Find window.

Can I also perform Boolean and multi criteria searches in Outlook without using Advanced Find?

AND/OR Search Query buttonThe Advanced Find dialog indeed provides a nice WYSIWYG interface to build more complex search queries with relative ease.

The Search field at the top of your message list might look quite Spartan at first, it’s actually quite powerful when you know the correct search query syntax and field names.

While performing a search query based on a partial string or with special characters still isn’t possible in the Search field, performing a Boolean search with multiple criteria is definitely possible.

Search query example

Search Outlook buttonHow to perform a Boolean search with multiple search criteria might be best explained with an example.

In this example, we’re going to search our entire mailbox for emails that have an invoice attached to them but are not from Amazon. The envisioned query in words is as follows;

  • The word “invoice” in either the subject OR the body,
  • AND
  • Has an attachment,
  • AND
  • NOT be from Amazon,
  • AND
  • Should search all mail folders.

The actual search for this example query is;

(subject:invoice OR body:invoice) AND hasattachments:yes NOT from:Amazon

In addition, you’d set the Search Scope to Current Mailbox. This can be done via the dropdown list next to the Search field or the Scope group on the Search.

Performing a Boolean Search in the Search field of Outlook for Microsoft 365.
Performing a Boolean Search in the Search field of Outlook for Microsoft 365.

Performing a Boolean Search in the Search field of Outlook 2013 / 2016 / 2019 / 2021.
Performing a Boolean Search in the Search field of Outlook 2013 / 2016 / 2019 / 2021.

Breaking down the example

How? buttonSo how does this query work?

First of all, we are directly targeting the fields that we want to query. Some of them are quite straightforward like “subject”, “body” and “from” while others can be inserted via the Refine group on the Search tab or by looking them up in this reference guide.

By using brackets, we can isolate the OR query and basically join the results for the Subject and Body fields.

With the AND statement, we are looking in these joined results and only select those which contain attachments.

With the NOT statement, we are filtering the results even further and discard the emails that are from Amazon from the results. So basically you could also read it as “AND NOT”.

Alternative: Use Search Folders, especially for repeated searches

Search Folder buttonAs you can imagine, there are some search queries which can get quite complex or long to type and you might long for that WYSIWYG editor again.

Luckily, there still is a way to get it by creating a Search Folder. The added benefit is that you can save your Search Query for reuse or create a Search Folder for the static part of your query and use the Search field for the variables like for instance the Date or From field.

Step 1: Enable the Query Builder
If you haven’t done so already, enable the Query Builder in Outlook by creating the following Registry key.

  1. Open the Registry Editor:
    Start-> type: regedit
  2. Browse to the following location in the registry
    HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Outlook\
  3. Choose: Edit-> New Key
  4. Name the key: QueryBuilder

Step 2: Create the Search Folder
Now you can create a Search Folder and use the Query Builder tab to construct your query.

  1. Create a new Search Folder in one of the following ways;
    • Right click on Search Folders in the Navigation Pane and choose: New Search Folder…
    • Classic Ribbon
      Folder-> New Search Folder
    • Keyboard shortcut
      CTRL+SHIFT+P
  2. At the bottom of the dialog, select: Create a custom Search Folder.
  3. Press the Choose… button.
  4. Specify a name for your Search Folder.
  5. Use the Browse… button to select which folders to search in.
  6. Press the Criteria… button.
  7. Select the Query Builder tab to construct your Boolean Search Query.

Search Folder Criteria - Query Builder - AND and OR statements
Part of the Boolean Search Query can be saved as a Search Folder as well. To get the same results as from the example, all you’d have to do is press the “Has Attachments” button on the Search tab of the Ribbon.