Date calculations formula

xcelnovice

Board Regular
Joined
Dec 31, 2011
Messages
81
I have 2 dates i.e. 5-Dec-16 in cell A1 & 10-Nov-17 in cell B1. Is there a way to calculate the number of days broken out relative to each year? Thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Can you clarify what you mean by broken out? As in, what day # 5-dec-16 is in the current year, or the amount of days in between both dates?
 
Upvote 0
Try this formula in any cell:
=DATE(YEAR(A1)+1,1,1)-A1 & " Days in " & YEAR(A1) & " " & B1 - DATE(YEAR(A1)+1,1,1) + 1 & " Days in " & YEAR(B1)

If you want to separate them then it would be:
=DATE(YEAR(A1)+1,1,1)-A1 for days in year 1
=B1 - DATE(YEAR(A1)+1,1,1) + 1 for days in year 2

EDIT: Format cell as text
 
Last edited:
Upvote 0
Toy with this I had it in C1 > =IF(TEXT(A1,"yyyy") < TEXT(B1,"yyyy"),TEXT(A2-A1,"###")&" - "&TEXT(B1-A2,"###"),0)

I put 5/12/2016 in A1
10/11/2017 in B1
31/12/2016 in A2
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,570
Messages
6,120,296
Members
448,954
Latest member
EmmeEnne1979

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top