How to count the number of flagged messages in Outlook?
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
a name="a1"> 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](http://cdn.extendoffice.com/images/stories/doc-outlook/count-flagged-emails/doc-count-flagged-items-1.png)
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](http://cdn.extendoffice.com/images/stories/doc-outlook/count-flagged-emails/doc-count-flagged-items-2.png)
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](http://cdn.extendoffice.com/images/stories/doc-outlook/count-flagged-emails/doc-count-flagged-items-3.png)
a name="a2"> 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)
Next
Next
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](http://cdn.extendoffice.com/images/stories/doc-outlook/count-flagged-emails/doc-count-flagged-items-4.png)
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](http://cdn.extendoffice.com/images/stories/doc-outlook/count-flagged-emails/doc-count-flagged-items-5.png)
Count the number of today, yesterday, read, unread, total items...in 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. ![]() Kutools for Outlook: with more than 70+ handy and free Outlook add-ins, download the free version now . |
Best Office Productivity Tools
Breaking News: Kutools for Outlook Launches Free Version!
Experience the all-new Kutools for Outlook FREE version with 70+ incredible features, yours to use FOREVER! Click to download now!
📧 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 Pro: Batch 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 ...
![kutools for outlook features1](http://cdn.extendoffice.com/images/stories/kto-ad-sun/kto19.0-kutools-100.png)
![kutools for outlook features2](http://cdn.extendoffice.com/images/stories/kto-ad-sun/kto19.0-plus-100.png)