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: Calculating the Day of the Year.

Calculating the Day of the Year

by Allen Wyatt
(last updated June 11, 2018)


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:


The reason that the first formula uses a date of 12/31/2017 is so the result will show the actual day number. Using these formulas, the result of 1/1/2018 in cell D27 would result in 1, 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, and 2016. 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. ...


Understanding ASCII and ANSI Characters

Two of the most common character coding schemes used in computers go by the acronyms ASCII and ANSI. This tip explains a ...

Discover More

Deleting a Macro

Don't need that old macro any more? Here's how to get rid of it so that it is no longer a part of your workbook.

Discover More

Inserting Text with a Shortcut Key

The AutoText capabilities of Word are quite powerful, allowing you to insert all sorts of "boilerplate" information in ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

The EDATE Function

Want to figure a date a certain number of months in the future or past? The EDATE function may be just what you need for ...

Discover More

Using a Cell Value as a Worksheet Name in a Formula

Excel allows you to easily develop formulas that pull values from worksheets and workbooks other than the one in which ...

Discover More

Random Numbers in a Range

Excel provides several different functions that you can use to generate random numbers. One of the most useful is the ...

Discover More

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

View most recent newsletter.


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}] 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 six more than 7?

2016-04-15 13:05:07


Given any date (any year) in cell A1,

=A1-DATEVALUE("1/1/"&YEAR(A1))+1 gives the day of the year.

=DATEVALUE("12/31/"&YEAR(A1))-A1 gives the number of days remaining in that year.

Regarding Brent's question, mm/dd/yyyy cannot be determined given only the day of the year; the year must also be specified. If the day of the year is in cell A1 and the year is in cell B1, then

=DATEVALUE("1/1/"&B1)+A1-1 gives the date (which can be formatted as mm/dd/yyyy)

2016-04-15 10:14:36


This is good. I use this as part of my Purchase Order number. Great reference.

2016-04-15 09:36:36

Brent Nielsen

What if you have the day of the year but wanted it in month/day/year format, is there an easy formula to provide this result?
PS I like the suggested comments.

2016-04-15 09:26:08

David Briggs

Alternatively, you could use the DATEDIF Function

Day of the Year

Days Left

2016-04-15 07:14:08


to generalise for any dates, derive the start/end of year using the YEAR of the source date.

So assuming the date is in A2.

day of year=A2-DATE(YEAR(A2)-1,12,31)
days remaining=DATE(YEAR(A2),12,31)-A2
or =DATE(YEAR(A2)+1,1,1)-A2
depending if you want to include the current day or not.

2013-06-03 08:16:18


Huh, for some reason I never knew you could use string literals for dates. Guess I just assumed it wouldn't work so I never tried it. Good tip.

If you want to generalize the formula a bit you could use =TODAY()-DATE(YEAR(TODAY())-1,12,31) to give you the current number of days into the year you are or =DATE(YEAR(TODAY()),12,31)-TODAY() for the number of days remaining (replace the both TODAY()'s with a cell reference to get the number of days into that year for that date).

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

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.