Written by Allen Wyatt (last updated October 24, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
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/2017" ="12/31/2018"-D27
The reason that the first formula uses a date of 12/31/2018 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:
Figure 1. The Number tab of the Format Cells dialog box.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8727) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Calculating the Day of the Year.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
When performing a statistical analysis on a large dataset, you may want to use GEOMEAN to figure out the geometric mean ...
Discover MoreGot a ton of names from which you need to select a few random names? There are several ways you can extract what you ...
Discover MoreVLOOKUP is a great function to use in accessing data based on a lookup value. Problem is, you can't easily return ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-10-24 08:22:23
Joe Lamontagne
I believe that in this sentence, "The reason that the first formula uses a date of 12/31/2018...," "2018" should be "2017."
2022-10-24 06:41:21
Phil Vaughan
Hi Allen,
Calculating the day of the year...
How about the following:
=DAYS(D27,CONCATENATE("31/12/",YEAR(D27)-1)) ' Day of the year
=DAYS(CONCATENATE("31/12/",YEAR(D27)),D27)+1 ' Days to go in the year
Cheers, Phil
2018-08-06 14:25:13
D Dodge
A more generic formula not limited to 2018 would be:
=TODAY()-CONCAT("1/1/",YEAR(TODAY()))
This gives you the day number for today. Replace both TODAY() with a cell reference if you want the day number for a specific date in your spreadsheet.
The number of days remaining can also be year independent:
=IF(MOD(YEAR(TODAY()),4)=0,366-A1,365-A1)
where A1 is the cell containing the day of year number calculation. Again, replace TODAY() with a cell reference if a specific date other than today is used. As mentioned in the article, both cells need to be formatted as NUMBER with zero decimal points.
2018-08-05 10:29:46
Allen
Simon, you are correct. I changed the article to reflect 2018, as it should.
-Allen
2018-08-05 04:01:50
Simon Freeman
(A) Don't forget to change the date to 31/12/2017 in countries where dd/mm/yyyy is the norm.
(B) Shouldn't the date in the second formula be 12/31/2018 (not 2017) to get the days to the end of the year.
2018-08-04 06:53:20
Russell
=D27-Date(Year(D27),1,0)
would also work, and means you don't have to manually enter the year
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2023 Sharon Parq Associates, Inc.
Comments