Jonathan developed a worksheet that tracks due dates for various departmental documents. He wondered if there was a way for Excel to somehow alert him if the due date for a particular document was approaching.
There are several ways that this can be done in Excel, and you should pick the method that is best for your purposes. The first method is to simply add a column to your worksheet that will be used for the alert. Assuming your due date is in column F, you could place the following type of formula in column G:
The formula checks to see if the date in cell F3 is earlier than a week from today. If so, then the formula displays "<<<" in the cell. The effect of this formula is to alert you to any date that is either past or within the next week.
Another approach is to use the conditional formatting capabilities of Excel. Follow these steps:
This is a two-tiered format, and you end up with two levels of alert. If the due date is already past, then it shows up as red. If the due date is today or within the next seven days, then it shows up in blue.
Comments for this tip:
David 05 Apr 2015, 03:37
Thanks Barry. I really appreciate it!
Barry 03 Apr 2015, 07:06
There is an article and code examples on using Gmail with Excel macros
Hopefully this is solve your problem
Haider 02 Apr 2015, 19:25
i want to create a sheet which will give me daily alerts example if i have tomorrow events its should give me alert in green column in one day advance and when its reach to same date (event date) it should give alert in read column
THANKS YOU SO MUCH FOR YOUR ASSISTANCE
David 02 Apr 2015, 05:25
@Barry - wow, thanks. Unfortunately, I don't use Outlook as I am hooked on Gmail. Nevertheless, thanks for the detailed response.
Barry 31 Mar 2015, 05:38
Yes you can send an email from Excel but is quite restricted unless your email Client has a VB object model accessible by Excel which generally means that you need to be using Microsoft Outlook as your email client.
In either case the "alert" is a continuing condition whereas sending an email is an individual event, so steps have to be taken to only send the email once, and if required build in any re-sending at prescribed intervals.
Ron de Bruin (Excel MVP) has lots of example VBA code on his website for sending emails: http://www.rondebruin.nl/win/section1.htm
I use the following sub-routine to send an email from MS Outlook adapted from a routine from Ron de Bruin:
Sub SendeMail(strTo As String, strSubject As String, strBody As String, Optional strCC As String, Optional strBCC As String, Optional strAttachment As String)
'Working in Excel 2000-2013
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
.To = strTo
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strBody & BCSSig
.Send 'or use .Display to display the finished email without sending (useful for debugging)
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
This is then simply called in the main macro using "SendeMail" plus the appropriate parameters (To address, Subject and body text plus optionally any CC, BCC, and/or attachments. E.G.
SendeMail "Test@Test.com", "This is the Subject", "This is the body text"
Multiple recipients can be emailed by using a ";" as a delimiter between email addresses in the To, CC, or BCC strings.
David Shalev 30 Mar 2015, 12:35
Is there anyway to have Excel trigger an email alert when a particular condition is met? In other words, rather than a conditional format, have Excel email a notification? My guess is no, but thought I would ask!
Barry 30 Mar 2015, 05:51
As you'll be re-sorting data every time something is changed there should be no necessity to re-sort when the file is opened.
If you place the code below on the codepage for the sheet containing your data this will sort the data whenever any data (date) in column C is changed.
To highlight expired entries use one of the methods mentioned in my other comments to this Tip.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C:C")) Is Nothing Then Exit Sub
ActiveSheet.Sort.SortFields.Add Key:=Range("C2"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
Ahsan Shah 30 Mar 2015, 01:53
Is There anyway to highlight and sort entire row according to date ?
NAME DESIGNATION EXPIRY DATE
123 ABC 26/mar/15
345 ABC 23/MAR/15
678 ABC 20/MAR/15
Now I want to sort them according to expiry dates and want to highlight them Automatically every time i open sheet or present date.
Barry 26 Mar 2015, 06:22
What you want is quite easy, assuming your expiry date is in column M
The term "M3>=TODAY()" makes the AND function false if the expiry date is passed, the other term L3<>"" remove the highlight if there is no date in L3.
Clare 25 Mar 2015, 07:23
Hi I am hoping the first =IF(L$3<(TODAY()+14),"<<<","")
will work, can I add an expired date to this also?
Barry 24 Mar 2015, 06:07
I do this on several spreadsheets that I use for keeping tabs on unpaid invoices.
First of all, select the range of data that this will be applicable to, then select the top leftmost cell(if you have a header row then this will be cell A2). In the Conditional Formatting dialogue box use the drop down on the "Cell Value is" and select "Formula Is".
Assuming the due date is in column H and the Date Paid is in column I then put the following formula in the formula box:
set the formatting that you want if the due date is past, and click OK.
If the top leftmost cell is say A3 then the formula would be =AND($H3<today(),$H3<>"",$I3="")
The secret is in the terms in the AND function the first ($H2<Today()) determines if the date is past due, the second term ($H2<>"") prevents the highlight if the due date is blank, and the the third term ($I2="") takes the highlight off as soon as you enter the Date Paid into the cell (it actually tests for a blank cell so anything in the cell will remove the highlight).
The "$" signs in the formula allow you to conditionally format the whole row but each cell is still testing the same columns, so the whole row will be lighted not just the Date cells.
In my spreadsheets I have usually a second condition which turns the crow red if the Date Due is 30days overdue (use the term $H2+30<today(). This needs to be the first condition to override any other condition set.
Clare 23 Mar 2015, 08:19
What I am trying to do is have a column highlighted when a due date is approaching & past. The due date I have is in another cell.
This is a warning to me when I need to chase items that are late or overdue.
I would then like to be able to add my approval date in the column and the cell then not be highlighted.
hoping you can help!
Marc T. 13 Mar 2015, 12:07
Thank you this is exactly what I was looking for.
Marie C. 10 Mar 2015, 14:58
As an Excel newbie, I really appreciate your tips and tricks. I was having trouble constructing a due date formula and after carefully following your step by step guide I identified the issue. I am so grateful for you taking the time to share your knowledge and expertise! Sincerely, Marie C.
Leave your own comment: