Determining Contract Weeks

Written by Allen Wyatt (last updated April 6, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


Nicole needs to count the number of weeks worked on a contract. The contract start date (cell A1) would be November 15, which should appear in cell C1 as week one. So, when November 22 rolls around, it would be week two. When a contract completion date is entered in cell B1, then cell C1 should reflect the number of weeks between A1 and B1, rounded up as indicated. Nicole wonders if there is a function or formula that will help her determine the correct number of contract weeks.

There are any number of formulas you could use to determine your contract weeks. Any formula you use, however, should check cell B1, and if it is blank (meaning that the contract has not ended), then you could simply do your calculation based on today's date. Here is a formula that does the check and will return the proper contract weeks:

=IF(ISBLANK(B1),ROUNDUP((TODAY()-A1)/7,0),ROUNDUP((B1-A1)/7,0))

The formula could be shortened if you placed the IF function within the ROUNDUP function, in this manner:

=ROUNDUP((IF(ISBLANK(B1),TODAY(),B1)-A1)/7,0)

Of course, if you wanted to not use today's date in your calculations, but instead indicate that the contract is still open, you could go back to this variation of the first formula:

=IF(ISBLANK(B1),"Contract Open",ROUNDUP((B1-A1)/7,0))

All of these example formulas, so far, may not handle the one-week boundary properly. For instance, if the contract start is November 15 and the contract end is November 22, then the formulas return 1. However, you may want it to return 2, meaning that since the contract ended on November 22, then it should always consider that day a second week. If that is the case, then you simply need to add 1 to any of the formulas, as shown here:

=ROUNDUP((IF(ISBLANK(B1),TODAY(),B1)-A1+1)/7,0)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13592) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Forcing Input to Uppercase

If you type information into a workbook, you may want to make sure that what you type is always stored in uppercase. ...

Discover More

Using Message Boxes

If your macro needs to communicate with a user, one simple way to do it is to use a message box. Here's how to use this ...

Discover More

Finding the Lowest Numbers

Need to find the lowest numbers in a range of values? It's easy to do using the SMALL worksheet function, or you can use ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Converting Coded Dates into Real Dates

Sometimes the format in which you receive data is not the same format that would be optimal for Excel. For instance, you ...

Discover More

Calculating an Age On a Given Date

Start putting dates in a worksheet (especially birthdates), and sooner or later you will need to calculate an age based ...

Discover More

Month for the Nth Sunday

Doing math with dates is quite easy in Excel. As this tip illustrates, this fact makes it easy to figure out the Nth ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.