Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Forcing Dates Forward.
by Allen Wyatt
(last updated October 29, 2016)
Roger is keeping track of invoices in an Excel worksheet. All of the invoices need to be submitted with a due date for the 28th of the month, and Roger wondered if there was a way to force a date to always "jump forward" to the next instance of the 28th.
The cleanest way to force dates forward is to create a formula that will examine a date in a cell and then force that date to the next desired date, such as the 28th. The following formula is a good one to start with:
Remember that this is a single formula; it is entered into a single cell. This formula examines the date in cell A1. If the DAY value of the date is greater than 28, then the formula constructs and returns a date that is equal to the 28th of the next following. If it is less than or equal to 28, then the 28th of the current month is returned.
There is an even shorter way to render an acceptable formula, however—one that entirely gets rid of the IF function:
This uses the current year as the year, and the day is always 28. The month uses a Boolean calculation. If the day is greater than 28, then (Day(A1)>28) will be TRUE and will calculate as a 1, thereby adding 1 to the current month. If it is less than or equal to 28 it will be FALSE and calculate as a 0, just calculating the current month.
If you don't want to be "strict" giving some people only a day (4/27/2012 will give a due date of 4/28/2012), you could plan on giving them at least a week with the formula:
This would give the 28th of the current month for the 1st thru 21st, but for later dates it will jump to the 28th of the following month.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11603) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Forcing Dates Forward.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
When you load data into Excel that was created in other programs, the formatting used for some types of data (such as ...Discover More
Start putting dates in a worksheet (especially birthdates), and sooner or later you will need to calculate an age based ...Discover More
It can be handy to know when specific weekdays occur within a range of dates. Figuring out this information, using ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.