将日期更改为会计年度 [英] Change the date to fiscal year
问题描述
我想在Excel中编写一个函数来更改日期。逻辑是这样的:如果月份是(一月,二月或三月),则结果显示我过去一年(-1年);如果月份是(四月至十二月),则结果显示当前年份(哪一年是
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).
示例:如果日期为02,Jan,2012,则结果显示为2011,否则为2012。
example: if date is 02,Jan,2012 the result show me 2011 else show me 2012.
推荐答案
要提取财政年度使用:
=YEAR(A1) + IF(MONTH(A1)>=4,1,0)
我认为您需要的是:
=YEAR(A1) - IF(MONTH(A1)>=4,0,1)
如果月份在第4个月之前,则减去1年,否则保留同一年。我不会将其转换为完整日期 DD / MM / YYYY
减去1年,以避免混淆,将其保留为仅一年 YYYY
。
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
.
这篇关于将日期更改为会计年度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!