Note: The other languages of the website are Google-translated. Back to English
Log in  \/ 
x
or
x
Register  \/ 
x

or

How to calculate number of days in a month or a year in Excel?

As we all know, there are leap years and common years where leap year has 366 days and common year has 365 days. To calculate the number of days in a month or a year based on a date as below screenshot shown, this article will help you.


Calculate number of days in a given month with formulas

If you have a list of date in a column, to calculate the days in a month, please apply the following formulas:

Enter any of the below formulas into a blank cell beside your date, and then drag the fill handle down to the cells that you want to calculate the days in the specific month, see screenshot:

=DAY(DATE(YEAR(A2),MONTH(A2)+1,1)-1)
=DAY(EOMONTH(A2,0))

Note: In the above formulas, A2 is the date cell that you want to get the number of days in a month based on.


Calculate number of days in a given year with formulas

To get the number of days in a year, please do as this:

Enter the following formula into a blank cell beside your date cell, then drag the fill handle down to the cells that you want to calculate the days in the specific year, see screenshot:

=DATE(YEAR(A2),12,31)-DATE(YEAR(A2),1,1)+1

Note: If you just have year numbers in the column, the below formula can help you to calculate the days in the given years as following screenshot shown:

=365+IF(MOD(A2,4),0,1)


Calculate number of days in a given month or year with a useful feature

If you have Kutools for Excel, with its Calculate days in year / Calculate days in month features, you can get the the number of days in a specific month or year without remembering any formulas.

Note:To apply these Calculate days in year / Calculate days in month features, firstly, you should download the Kutools for Excel, and then apply the features quickly and easily.

After installing Kutools for Excel, please do as follows:

1. Click to select a cell where you want to output the result, see screenshot:

2. And then click Kutools > Formula Helper > Formula Helper, see screenshot:

3. In the Formulas Helper dialog box, please do the following operations:

  • Select Math from the Formula Type drop down list;
  • In the Choose a formula list box, click to select Calculate days in year or Calculate days in month option as you need;
  • Then, in the Arguments input section, select the cell containing the date that you want to get the days of month or year from the date .

Tips: In the Date textbox, you should change the default absolute cell reference to relative cell reference for dragging the formula correctly.

4. And then, click Ok button, the first result will be calculated, then select the first formula cell, and drag the fill handle down to the cells for applying this formula, and you will get the number of days in a year as below screenshot shown:

Selecting the Calculate days in month option to get the number of days in specific months, see screenshot:

Download and free trial Kutools for Excel Now !


More relative articles:

  • Count The Number Of Days, Workdays, Weekends Between Two Dates
  • Have you ever needed to count the number of days between two dates in Excel? May be, sometimes, you just only want to calculate the workdays between two dates, and sometime, you need to count the weekend days only between the two dates. How could you count the number of days between two dates in a certain condition?
  • Calculate Days Left In Month Or Year In Excel
  • For certain case, you may want to know the number of remaining days in a month or a year. Supposing, the date of today is 2014/10/12, and you want to calculate the days left in this month (October) or this year (2014), that is to say, there is remaining 19 days of this month and 80 days of this year. Please know more details from the below article.

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    pstraton · 11 months ago
    Your MONTH(EOMONTH(A2,(DAY(A2)>15)+0)) formula does not work correctly for 28, 29 or 30-day months due to the hard coded comparison to the 15th day of the month. For example, for the date 2/14/2021, it calculates the round-up month number to be 2 (February). But it should be 3 (March) given that the 14th is the half-month day of 28-day February (equivalent to a fraction value 0.5, which should round up, not down). Similarly, for the date 4/15/2021, it calculates the round-up month number to be 4 (April). But it should be 5 (May) given that the 15th is the half-month day of 30-day April (again equivalent to a fraction value 0.5).

    Here's a corrected version of your formula that works for all months:

    =MONTH(EOMONTH(A1,(DAY(A1)>=DAY(EOMONTH(A1,0))/2)-1)+1)
  • To post as a guest, your comment is unpublished.
    Charles · 2 years ago
    How about this for Number of Days in THIS year (covers leap year or not)…. =EOMONTH(DATE(YEAR(TODAY()),12,1),0) - DATE(YEAR(TODAY()),1,0)

    EOMONTH finds December 31 of this year, from TODAY() and them subtracts the day before January 1st using the DATE YEAR TODAY using 0 which is one less than 1.