Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. 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: Calculating the Day of the Year.

Calculating the Day of the Year

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


You've probably seen it on calendars before—some include an indication that "Today is the 123 day of the year with 242 remaining." You can easily calculate the day number of a year, as well as how many are remaining. For instance, let's assume you have a date in cell D27. You could use the following formulas to calculate, respectively, what day of the year it is and how many are still left:

=TRUNC(D27)-DATE(YEAR(D27)-1,12,31)
=DATE(YEAR(D27),12,31)-TRUNC(D27)

Using these formulas, the result of 1/1/2023 in cell D27 would be 1 and 364, respectively, meaning it is the first day of the year. (This is as it should be.)

Of course, once you enter the formulas, you need to format the cells as regular numbers. (Excel will, by default, try to format the cells as dates.) With the two cells selected, follow these steps:

  1. Display the Home tab of the ribbon.
  2. Click the small icon at the lower-right corner of the Number group. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is selected.
  4. In the Category list, choose Number. (See Figure 1.)
  5. Figure 1. The Number tab of the Format Cells dialog box.

  6. Make sure the Decimal Places option is set to 0.
  7. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8727) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Calculating the Day of the Year.

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

Proper Case Conversion with Exceptions

The PROPER worksheet function allows you to change the case of text so that only the first letter of each word is ...

Discover More

Finding the Mouse Pointer

Tired of losing the mouse pointer on the screen? I was too, until I discovered this nifty trick for finding that elusive ...

Discover More

Preventing Someone from Recreating a Protected Worksheet

When you share a protected workbook with other people, you may not want them to get around the protection by creating a ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Determining Columns in a Range

If you need to know the number of columns in a particular range, you can use the COLUMNS worksheet function. This tip ...

Discover More

Returning Values to the Left of a VLOOKUP

VLOOKUP is a great function to use in accessing data based on a lookup value. Problem is, you can't easily return ...

Discover More

Indirect References to a DSUM Parameter

Indirect references can be very helpful in formulas, but getting your head around how they work can sometimes be ...

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 one less than 9?

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.