Change the date to fiscal year

不羁的心 提交于 2019-12-11 02:38:53

问题


I want to write a function in Excel to change the date. The logic is like this: if the month is (Jan, Feb or March) the result show me one year past (-1 year) and if the month is (April to -December) the result show the current year (which year the date shows).

example: if date is 02,Jan,2012 the result show me 2011 else show me 2012.


回答1:


To extract fiscal year use:

=YEAR(A1) + IF(MONTH(A1)>=4,1,0)

I think in your case you would need:

=YEAR(A1) - IF(MONTH(A1)>=4,0,1)

If the months is before 4th month then subtract 1 year, else keep the same year. I wouldn't convert it to a full date DD/MM/YYYY with a 1 year subtracted, to avoid confusion keep it as year only YYYY.




回答2:


=IF(MONTH(G3) >=4, YEAR(G3), YEAR(G3) - 1) where G3 is the date to test, is one way.




回答3:


Please try:

=IF(OR(MONTH(A1)=1,MONTH(A1)=2,MONTH(A1)=3),2011,2012)



回答4:


With 02-Jan-2012 in A1 try,

=YEAR(A1)-(MONTH(A1)<4)

For a full date use one of these,

=DATE(YEAR(A1)-(MONTH(A1)<4), MONTH(A1), DAY(A1))
=EDATE(A1, -(MONTH(A1)<4)*12)



回答5:


Already plenty of answers, but thought I'd throw another one up:

=YEAR(DATE(YEAR(A1),MONTH(A1)-3,DAY(A1)))


来源:https://stackoverflow.com/questions/29843505/change-the-date-to-fiscal-year

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!