Calculate number of days between two dates when one is created by another formula

SaraWitch

Active Member
Joined
Sep 29, 2015
Messages
322
Office Version
  1. 365
Platform
  1. Windows
Hello peeps,

I am trying to calculate the number of days/nights between two dates (A2 & B2) and use a further date (D2) if the latter (B2) is empty. However, the further date (D2) is created by a formula, which doesn't work in my final formula (E2).

Fiscal nights formula.xlsx
ABCDE
1Date placedDate endedFiscal yearYear start dateNumber of nights
203/11/202304/11/20232023/2403/04/2023215
Sheet1
Cell Formulas
RangeFormula
C2C2=IF(A2="","",IF(MONTH(A2)<=3,(YEAR(A2)-1)&"/"&RIGHT(YEAR(A2),2),YEAR(A2)&"/"&RIGHT((YEAR(A2)+1),2)))
D2D2=IF(A2="","",IF(C2="2022/23","04/04/2022",IF(C2="2023/24","03/04/2023")))
E2E2=IF(A2="","",IF(B2=0,TODAY(),B2)-IF(D2<=A2,A2,D2))


Any help would be appreciated! :)
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
C2 change to:

=IF(A2="","",IF(C2="2022/23",DATE(2022,4,4),IF(C2="2023/24",DATE(2023,4,4))))

Or:

=IF(A2="","",DATE(LEFT(C2,4),4,4))
 
Upvote 0
Solution

Forum statistics

Threads
1,216,212
Messages
6,129,531
Members
449,515
Latest member
lukaderanged

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