Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to count emails by category in Outlook?

You might have highlighted emails with color categories in Outlook. But, do you know how to count emails by categories? This article will share two solutions:

Kutools for Outlook: 100+ New Advanced Tools for Outlook.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10.
Classic Menu: Bring Old Menus and Toolbars Back to Office 2007, 2010, 2013, 2016 and 2019.

arrow blue right bubble Count emails by category in Outlook with Instant Search feature

This method will guide yo to find out all emails marked with the specified color categories by the Instant Search feature, and then easily get the total number of all search results at the Status bar.

1. In the Mail view, press Ctrl + E keys simultaneously to activate the Search Tools.

2. Click Search > Categorized, and then select the specified color category you will count emails by.

3. Now all emails marked with the specified color category are found out and listed in the mail list. And you can easily get the total number of all search results at the status bar. See screenshot:

Notes:

(1) For counting emails marked with Yellow category and Orange category simultaneously, please type the search criteria category:="Yellow Category" AND "Orange Category" into the Instant Search box directly:

(2) For counting emails marked with Yellow category or Orange category simultaneously, please type the search criteria category:="Yellow Category" OR "Orange Category" into the Instant Search box directly.


arrow blue right bubble Count emails by category in Outlook with VBA

This method will introduce a VBA to count emails by category in a custom date range in Outlook. Please do as follows:

1. In the Mail view, select the email folder that you will count emails.

2. Press Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and then paste below VBA code into the new opening Module window:

VBA: Count emails by category in Outlook

Sub CategoriesEmails()

Dim oFolder As MAPIFolder
Dim oDict As Object
Dim sStartDate As String
Dim sEndDate As String
Dim oItems As Outlook.Items
Dim sStr As String
Dim sMsg As String


On Error Resume Next
Set oFolder = Application.ActiveExplorer.CurrentFolder

Set oDict = CreateObject("Scripting.Dictionary")

sStartDate = InputBox("Type the start date (format MM/DD/YYYY)")
sEndDate = InputBox("Type the end date (format MM/DD/YYYY)")

Set oItems = oFolder.Items.Restrict("[Received] >= '" & sStartDate & "' And [Received] <= '" & sEndDate & "'")
oItems.SetColumns ("Categories")

For Each aitem In oItems
sStr = aitem.Categories
If Not oDict.Exists(sStr) Then
oDict(sStr) = 0
End If
oDict(sStr) = CLng(oDict(sStr)) + 1
Next aitem

sMsg = ""
For Each aKey In oDict.Keys
sMsg = sMsg & aKey & ":   " & oDict(aKey) & vbCrLf
Next
MsgBox sMsg

Set oFolder = Nothing

 End Sub

4. Press the F5 key or click the Run button to run this VBA.

5. (1) In the first popping out Microsoft Outlook dialog box, please type the start date of the custom date range you will count emails within, and click the OK button. (2) In the second Microsoft Outlook dialog box, please type the end date, and click the OK button. See screenshots:

And now a dialog box comes out and displays the numbers of emails marked with color categories. See screenshot:


arrow blue right bubbleRelated Articles

 

Recommended Productivity Tools

shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121

Kutools for Outlook - More than 100 Advanced Functions for Outlook, Improve 70% Efficiency For you

  • Complicated and repeated operations can be done a one-time processing in seconds.
  • Forward multiple emails individually with one-click, and auto forward by rules.
  • Auto CC/BCC every sending email and easy for customizing rules, and auto reply without requiring exchange server.
  • Powerful junk emails filter, remove duplicate emails, reply with attachment, bunch of one-click operations, and so on...
  • 60-day unlimited free trial. 60-day money back guarantee. 2 years free upgrade and support. Buy once, use forever.
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Abhishek Singhal · 5 months ago
    Hi Thanks, it works perfectly, just one quick query- Can we get the Msgbox results to be displayed in excel, as whenever i want to run the macro it should be displayed in excel.
    every time one below the previous results.
  • To post as a guest, your comment is unpublished.
    Emma · 2 years ago
    This is perfect, but how can I change the VBA to include subfolders of the current folder in the count?