2 Methods to Quickly Count Emails by Sender in Your Outlook

If you would like to count the emails by sender, you can refer to this article. Here we will expose 2 quick approaches to you.

So as to know the most active sender for you, you may want to count the emails by sender. Although Outlook doesn’t provide a direct feature for this, you still can seek some workarounds, such as the following Method 1. If you think the Method 1 is too tedious, you can opt for the Method 2. It is much more effective in that it uses VBA to quickly count emails by sender and export the counts to Excel. Now read on to the two ways in detail. Here we’ll take emails in Inbox for an example.

Method 1: Get Counts after Grouping Items by “From” Field

  1. To begin with, launch Outlook application.
  2. Then, open the inbox folder.
  3. Next, switch to “View” tab.
  4. Subsequently, choose “From” in the “Arrangement” group.Arrange Inbox Items by "From"
  5. At once, all the inbox items have been separated into different groups as per the different senders.
  6. Now, to count the items from a specific sender, you can select all items in the related group and press “Enter” key. In the popup warning, you can see the count.Get Item Count in Warning

This means is quite easy, but the item counts actually include the other types of items, like meeting invitations, task requests and receipts, not only email counts. Thus, if you only want to count emails, you can use the following way instead.

Method 2: Count Emails by Sender with Outlook VBA

  1. For a start, press “Alt + F11” key buttons in Outlook.
  2. Then, enable “MS Excel Object Library” according to “How to Add an Object Library Reference in VBA“.
  3. Next, copy the code below into an unused module.
Sub CountInboxEmailsbySender()
    Dim objDictionary As Object
    Dim objInbox As Outlook.Folder
    Dim i As Long
    Dim objMail As Outlook.MailItem
    Dim strSender As String
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkbook As Excel.Workbook
    Dim objExcelWorksheet As Excel.Worksheet
    Dim varSenders As Variant
    Dim varItemCounts As Variant
    Dim nLastRow As Integer
 
    Set objDictionary = CreateObject("Scripting.Dictionary")
    Set objInbox = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
 
    For i = objInbox.Items.Count To 1 Step -1
        If objInbox.Items(i).Class = olMail Then
           Set objMail = objInbox.Items(i)
           strSender = objMail.SenderEmailAddress
 
           If objDictionary.Exists(strSender) Then
              objDictionary.Item(strSender) = objDictionary.Item(strSender) + 1
           Else
              objDictionary.Add strSender, 1
           End If
        End If
    Next

    Set objExcelApp = CreateObject("Excel.Application")
    objExcelApp.Visible = True
    Set objExcelWorkbook = objExcelApp.Workbooks.Add
    Set objExcelWorksheet = objExcelWorkbook.Sheets(1)
 
    With objExcelWorksheet
         .Cells(1, 1) = "Sender"
         .Cells(1, 2) = "Count"
    End With
 
    varSenders = objDictionary.Keys
    varItemCounts = objDictionary.Items
 
    For i = LBound(varSenders) To UBound(varSenders)
        nLastRow = objExcelWorksheet.Range("A" & objExcelWorksheet.Rows.Count).End(xlUp).Row + 1
        With objExcelWorksheet
             .Cells(nLastRow, 1) = varSenders(i)
             .Cells(nLastRow, 2) = varItemCounts(i)
        End With
    Next
 
    objExcelWorksheet.Columns("A:B").AutoFit
End Sub

VBA Code - Count Inbox Emails by Sender

  1. After that, press “F5” key button.
  2. When macro finishes, a new Excel file will be displayed.
  3. As you can see, it contains the counts of inbox emails from different senders.Email Counts in Excel

Dispose of Frustrating Outlook Troubles

Maybe you have ever been subject to many problems in your Outlook. In order to address them effectively, you may long for a versatile and mighty way. Yet, in fact, there is not such a method. What you can do is to beware of your own operations in Outlook and make regular backups. Of course, if possible, we suggest that you had better keep an experienced fix tool handy, like DataNumen Outlook Repair. It can fix various PST issues and repair corrupt PST file like a breeze.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover Sql Server and outlook repair software products. For more information visit www.datanumen.com

6 responses to “2 Methods to Quickly Count Emails by Sender in Your Outlook”

  1. This line is not working.

    strSender = objMail.SenderEmailAddress

    Error 430 – Class does not support automation or does not support expected interface.

  2. I have several mailboxes in Outlook.
    I want to apply your Method #2 to one of the folders (not Inbox) of one of the mailboxes.
    How do I modify the macro?
    Thank you!!!

  3. Is there a way to do this with the archive folders as well? This seems to only check your current server side mailbox

Leave a Reply

Your email address will not be published. Required fields are marked *