Skip to main content

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

Author: Xiaoyang Last Modified: 2024-10-31

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

Calculate number of days in a given month with formulas

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

Calculate number of days by date with formula

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 by year with formula


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.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Enhanced with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing Kutools for Excel, please do as follows:

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

select a cell to output the result

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

click Formula Helper feature of kutools

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.

specify options in the dialog box

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:

the number of days in a year are extracted

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

get the number of days in specific months

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.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


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!