How to Group Your Received Emails by their Durations since Received in Outlook

By default, Outlook doesn’t support to group the received emails by their durations in month since received, such as 1 month, 2 months and 3 months, etc. This article will introduce how to add the related field and then re-group the received emails via Outlook VBA.

As you can see, Outlook will automatically group and sort the received emails by the received date, including “Today”, “Yesterday”, “Two Weeks Ago”, “Last Month” and “Older” and so on. Thus, some users may want to group the received mails on basis of their durations in month since the received date, such as 1 month, 2 months and 3 months, etc. Apparently, Outlook doesn’t support it in that there is no related field. Fortunately we still can achieve it with Outlook VBA. Read on to get the concrete VBA codes and the elaborate steps.

Group Received Emails by their Durations since Received

  1. To start with, launch Outlook turn to “Developer” tab.
  2. Then click on “Visual Basic” button, which will bring out a new window.
  3. Next in the popup window, open a new module and copy the following codes into it.
Public Sub AddMonthField()
    Dim olSel As Selection
    Dim obj As Object
    Dim olMail As MailItem
    Dim olProp As Outlook.UserProperty
    Dim strMonth
    Set olSel = Outlook.Application.ActiveExplorer.Selection
    On Error Resume Next
    For Each obj In olSel
        If TypeName(obj) = "MailItem" Then
           Set olMail = obj
           strMonth = DateDiff("m", olMail.ReceivedTime, Now)
           Set olProp = olMail.UserProperties.Add("Month", olNumber, True)
           olProp.Value = strMonth
        End If
End Sub

VBA Codes - Add a New Month Field

  1. After that, you can exit the “Visual Basic” window and add the new macro to the Quick Access Toolbar as usual.Add the New Macro to QAT
  2. Subsequently, you can back to your Inbox mail folder. Press “Ctrl + A” to select all of them. And then click on the new macro button in Quick Access Toolbar.
  3. Later you can switch to “View” tab and hit “View Settings” button.
  4. In the popup dialog box, click “Columns” button.
  5. Then in the new “Show Columns” dialog box, take the steps below:
  • At first, set “Select Available columns from” to “User-defined fields in Inbox”.
  • Then select “Month” from the “Available columns” box.
  • Next hit “Add” button.
  • Optionally, use “Move Up” and “Move Down” button to change the order.
  • Lastly click “OK”.Add the New Field
  1. After clicking “OK”, you will get back to “Advanced View Settings” dialog. Now hit “Group By” button.
  2. Later in “Group By” dialog box, firstly change “Select available fields from” to “User-defined fields in Inbox”, and then select “Month” from “Group items by” drop down list, and last click a series of “OK” to close all the dialog boxes.Group by Durations since Received
  3. Finally you can go back to your Inbox folder. You can see that all the emails are grouped by the number of months since their received date. Also, you can click “Month” column to select ascending or descending as per your needs.Group Your Received Emails by their Durations in Month since Received

Effectively Dispose of Vexing Outlook Errors

Outlook is susceptible to error. Moreover, if you are confronted with any errors, you’d better address them as soon as possible in that accumulating issues will lead to considerably serious consequences, such as Outlook PST mail corruption. If you have no current backups, you’ll have no choice but to employ a well-proven repair tool, like DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair corrupted SQL Server database and outlook repair software products. For more information visit

Leave a Reply

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