简体   繁体   English

Excel计算会计年度

[英]Excel work out fiscal year

The fiscal year starts on July 1 and ends on June 30th. 会计年度开始于7月1日,结束于6月30日。

I need to calculate the fiscal year + month in the following format 我需要以以下格式计算会计年度+月

26/05/2006  2005011
26/05/2006  2005011
09/06/2006  2005012
15/06/2006  2005012

My current formula is below. 我当前的公式如下。

=YEAR(A2)&"0"&MOD(MONTH(A2)-7,12)+1

The problem is that the formula populates the current year and not based on the fiscal year. 问题在于该公式填充当前年份,而不是基于会计年度。

25/05/2006  2006011
26/05/2006  2006011
26/05/2006  2006011
09/06/2006  2006012
15/06/2006  2006012

Use EDATE() 使用EDATE()

=YEAR(EDATE(A1,-6)) & "0" & TEXT(MONTH(EDATE(A1,-6)),"00")

在此处输入图片说明

you need to do a check for the current date to see if it is before or after your breakpoint of june 30/july 1st. 您需要检查当前日期以查看它是否在6月30日/ 7月1日的断点之前或之后。

=IF(A2<=Date(year(A2),6,30),Year(A2)-1,Year(A2))&"0"&MOD(MONTH(A2)-7,12)+1

So after you determine if you need to subtract 1 from your year or not, tack on the rest of your formula. 因此,在确定是否需要从年份中减去1后,继续其余的公式即可。

概念证明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM