Skip to main content

How to count the number of flagged messages in Outlook?

Author: Xiaoyang Last Modified: 2020-08-06

In outlook, you can flag the messages, contacts or tasks for making them outstanding, but, sometimes, you need to count the number of flagged items in your Outlook. How could you deal with this task in Outlook?

Count the number of flagged messages in one account with Search Folders

Count the number of flagged messages / contacts / tasks separately in all accounts with VBA code

Count the number of flagged messages in one account with Search Folders

To count the number of flagged emails in an account of Outlook, the Search Folders feature can help you, please do as this:

1. Right click Search Folders under your Email account, and then select New Search Folder, see screenshot:

doc count flagged items 1

2. Then a New Search Folder dialog box is popped out, click Mail flagged for follow up option in the Reading Mail section, see screenshot:

doc count flagged items 2

3. Then click OK, and all flagged messages are copied into the For Follow Up folder, and the total number of the flagged emails is displayed as following screenshot shown:

doc count flagged items 3

Count the number of flagged messages / contacts / tasks separately in all accounts with VBA code

If you want to count the number of all flagged items, such as emails, contacts and tasks in Outlook separately, the following VBA code can do you a favor.

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Then, click Insert > Module, copy and paste below code into the opened blank module, see screenshot:

VBA code: Count the number of flagged times in Outlook:

Dim GSeparateCount, GMailCount, GContactCount, GTaskCount As Long
Sub CountFlaggedItems()
Dim xStore As Outlook.Store
Dim xTotalCount As Long
Dim xPrompt As String
Dim xFolder As Folder
Dim i, k As Integer
On Error Resume Next
xTotalCount = 0
GMailCount = 0
GContactCount = 0
GTaskCount = 0
For Each xStore In Application.Session.Stores
    For Each xFolder In xStore.GetRootFolder.Folders
       Call ProcessFolders(xFolder)
xTotalCount = GMailCount + GContactCount + GTaskCount
xPrompt = xTotalCount & " items have been flagged, as follows: " & Chr(10) & Chr(10) & "Emails: " & GMailCount & Chr(10) & "Contacts: " & GContactCount & Chr(10) & "Tasks: " & GTaskCount
MsgBox xPrompt, vbInformation + vbOKOnly, "Kutools for Outlook"
End Sub
Sub ProcessFolders(ByVal CurFolder As Outlook.Folder)
Dim xSubfolder As Outlook.Folder
Dim xItem As Object
Dim i, k As Integer
On Error Resume Next
For i = CurFolder.Items.Count To 1 Step -1
    Set xItem = CurFolder.Items.item(i)
    Select Case xItem.Class
        Case olMail, olPost, olSharing
            If xItem.IsMarkedAsTask = True Then
                GMailCount = GMailCount + 1
            End If
        Case olContact, olDistList
            If xItem.IsMarkedAsTask = True Then
                GContactCount = GContactCount + 1
            End If
        Case olTask
            If CurFolder.DefaultItemType = olTaskItem Then
            GTaskCount = GTaskCount + 1
            End If
    End Select
Next i
If CurFolder.Folders.Count > 0 Then
        For k = CurFolder.Folders.Count To 1 Step -1
            Set xSubfolder = CurFolder.Folders.item(k)
            Call ProcessFolders(xSubfolder)
        Next k
    End If
End Sub

doc count flagged items 4

3. Then press F5 key to run this code, and a prompt box is popped out to tell you the total count of all flagged items as below screenshot shown:

doc count flagged items 5

Count the number of today, yesterday, read, unread, total Outlook

With Kutools for Outlook's powerful Statistics feature, you can get the number of itmes based on date, selected items, read, unread and so on as you need.

doc count flagged items 6

Kutools for Outlook: with more than 100+ handy Excel add-ins, free to try with no limitation in 60 days. Download and try the free trial now!

Best Office Productivity Tools

Master Outlook with Kutools: Powerful, Diverse & Forever Free!

Unlock 100+ premium features for a 30-day free trial; continue accessing 70+ powerful tools indefinitely at no cost after the trial ends!

🤖 Kutools AI : Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

📧 Email Automation: Auto Reply (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Remind you when important emails come  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Incoming Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Instantly unlock Kutools for Outlook with a single click—permanently free. Don't wait, download now and boost your efficiency!

Read More       Free Download      Purchase


Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Das ist ja jetzt wohl nicht die Wahrheit. Ich brauche VBA oder soll umständliche Ordneraktionen durchführen um die Zahl der aktuell gewählten Kontakte zu lesen? So lange es solche Zumutungen bei Office gibt wird Arbeiten mit dieser Suite keinen Spaß machen. Ich stoße immer wieder auf Funktionen, die man als Anwender bei einem Officeprogramm voraussetzt und muß dann leidvoll erfahren, dass man einfachste Vorgängen nur mit Kopfständen oder eben VBA erledigen kann. Super, Microsoft!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations