Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Last active August 17, 2022 16:32
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save peteristhegreat/c3f419bace8c3a3ae353 to your computer and use it in GitHub Desktop.
Save peteristhegreat/c3f419bace8c3a3ae353 to your computer and use it in GitHub Desktop.
Relative Date Time in Outlook and Excel (minutes ago, hours ago, days ago), like Gmail
Go to:
Ribbon > View > View Settings > Columns... > New Column...
Name: "Ago"
Type: Formula
Formula:
IIF( Now() - [Received] <1/24, MINUTE( Now()-[Received] ) & " minutes ago",IIF( Now()-[Received] <1, HOUR( Now()-[Received] ) & " hours ago",IIF( Now()-[Received] <31, INT( Now()-[Received] ) & " days ago", "months ago")))
E2
=NOW()-5/1440 # 5 minutes ago
=NOW()-0.5 # 12 hours ago
=NOW()-1.1 # 1 days ago
=NOW()-40 # months ago
=IF(E2<1/24,CONCATENATE(MINUTE(E2)," minutes ago"),IF(E2<1,CONCATENATE(HOUR(E2)," hours ago"),IF(E2<31,CONCATENATE(INT(E2)," days ago"), "months ago")))
@sheldonhull
Copy link

thank you for doing this. I was looking for a formula, and this was a great time saver for an outlook field showing time like this

@peteristhegreat
Copy link
Author

Awesome. Glad it was useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment