If Dave's response does not help:
The fact the we use different date formats dd/mm/yyyy and mm/dd/yyyy/ didn't help my initial understanding of the problem but I understand the difference now now. Why do you need it - maybe annual salary or other payment division by 365 or 366? The question is only curiosity. You do not need to answer as it is not necessary to know that to answer your question.
Calculating days that fall within the leap year and outside the leap year will be mildly complex (broadly):
- Identify whether the from year, the to year or a year or years between are leap year.
- break up the date ranges to before leap year, during leap year and after leap year.
- calculate the days in each component
- add them.
Excel takes all that in its stride with a normal calculation of days between dates.
Excel 2010
| A | B |
---|
1 | From | 6/06/2011 |
2 | To | 7/07/2013 |
3 | Days(inclusive) | 763 |
<tbody>
</tbody>
Sheet1
However, that does not break down to easily allow separation of the components of 366 days in 2012 and 397 days in the other years. The question now becomes, how complex does your formula need to become? Will your date ranges span long periods or will the duration always be less than two years?
If you need to add further information, there are two ways to put sample data on the forum in a way we can easily copy/paste to start working with your data:
The first is the recommended way:
Read Posting Aids on Guidelines for Forum Use
Choose an add-in (I find HTML Maker easy enough to use)
Following instructions on whichever add-in you choose to install
After installation, highlight the cells you want to copy to forum
and follow instructions to get a copy for the forum.
If using HTML make, this would be right-click one of the highlighted cells,
choose formula selection options then paste on the forum.
You will see HTML code when you paste but the result will be similar to above normal calcuation of days between dates.
The other method is to save your spreadsheet (personal data removed and sensitive data replaced) into a cloud location (e.g. Dropbox or OneDrive) and paste a link.
Warning: Some members may choose not open sample sheets posted via link.