Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. 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 April 15, 2016)

6

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:

=D27-"12/31/2012"
="12/31/2013"-D27

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

Changing Text Orientation

Word allows you to change the orientation of text contained within certain objects, such as AutoShapes, text boxes, and table ...

Discover More

Counting All Graphics

Need to know how many graphics a document contains? Getting at the true number may take a little more work than it first ...

Discover More

Heavy-Duty Footnotes

Word allows you to add footnotes to a document, but they are rather straightforward and simple in their application. If you ...

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)

Using COUNTIF with Colors

Excel allows you to easily format cells with different fonts, borders, and colors. If you want to count the number of cells ...

Discover More

Strange ATAN Results

You may use Excel's trigonometric functions to do some quick calculations, and suddenly notice that the results in your ...

Discover More

Ways to Concatenate Values

Users of the most recent versions of Excel have four different ways available to combine values into strings. Even those ...

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

2016-04-15 13:05:07

John

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

Dean

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
=DATEDIF( DATE(YEAR(TODAY()),1,0), TODAY(), "d" )

Days Left
=DATEDIF(TODAY(),DATE(YEAR(TODAY()),12,31),"d")


2016-04-15 07:14:08

Tony

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

Bryan

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
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.