I improved upon Barry Houdini's answer. I must thank him for getting to this point. His ideas of using max and min was much simpler than what I was trying to accomplish. Thanks!

My formula takes into account the FY of the start date, so you can use the formula across single or multiple FYs without manually changing the formula. It accounts for leap years and includes the 1st day in the calculation.

Essentially, this is a **[end date] minus [start date]** formula. If the [end date] is before the FY ends, use the [end date]. If the [end date] is after the FY ends, use September 30 (9/30) with the same FY as the [start date].

end date = [B1]

start date = [A1]

formula for end date `=MIN(B1,DATE(IF(MONTH(A1)<=9,YEAR(A1),YEAR(A1)+1),9,30))`

formula for start date `=A1`

formula together `=MIN(B1,DATE(IF(MONTH(A1)<=9,YEAR(A1),YEAR(A1)+1),9,30))-A1+1`

Examples in m/d/y format:

1/1/17 to 1/2/17 is 2 days

1/1/17 to 9/30/17 is 273 days

1/1/17 to 10/1/17 is 273 days

1/1/17 to 10/1/18 is 273 days

9/30/17 to 10/1/18 is 1 day

To change the FY to end 3/31 `=MIN(B1,DATE(IF(MONTH(A1)<=3,YEAR(A1),YEAR(A1)+1),3,31))-A1+1`