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

Searching for Character Formatting

Need to look for a piece of text possessing a particular formatting attribute? Here's the skinny on how this is accomplished.

Discover More

Setting Limit Line Spacing in the Equation Editor

The Equation Editor is a great way to add a professional-looking equation to your document. It allows you to modify many ...

Discover More

Using the Insert Key to Insert Text

The Insert key can be used for different purposes, depending on how you configure the program. This tip explains those uses ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

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

Discover More

Making VLOOKUP Case Sensitive

The VLOOKUP function, like other lookup functions in Excel, is not case sensitive. In other words, it doesn't matter whether ...

Discover More

Understanding the VLOOKUP Function

Functions are at the heart of Excel's power in working with data. One of the most misunderstood functions provided by Excel ...

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 nine more than 8?

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.