Excel:Next年期间

Excel:Next year period

如何根据当前月份和年份获取下一年的时间,例如:

  • Jan 2014 - Dec 2014
  • Feb 2014 - Jan 2015
  • Mar 2014 - Feb 2015
  • Apr 2014 - Mar 2015
  • May 2014 - Apr 2015
  • Jun 2014 - May 2015
  • Jul 2014 - Jun 2015
  • Aug 2014 - Jul 2015
  • Sep 2014 - Aug 2015
  • Oct 2014 - Sep 2015
  • Nov 2014 - Oct 2015
  • Dec 2014 - Nov 2015

下一期

等等

我试过以下公式:

=UPPER(TEXT(NOW();"MMM")) &" "& TEXT(NOW();"YY")-1

它在 2014 年 1 月 时工作正常,但不知道如何获得 2014 年 12 月2014 年 2 月 - 2015 年 1 月 等等?

假设您要查找年份的日期(作为日期序列号)在单元格 A1 中,以下内容应提供从那天开始的下一年:

=EOMONTH(A1,11) +DAY(A1) -1

示例:

   Input      Output
 1/18/2014   1/17/2015
 2/18/2014   2/17/2015
 3/18/2014   3/17/2015
 4/18/2014   4/17/2015
 5/18/2014   5/17/2015
 6/18/2014   6/17/2015
 7/18/2014   7/17/2015
 8/18/2014   8/17/2015
 9/18/2014   9/17/2015
10/18/2014  10/17/2015
11/18/2014  11/17/2015
12/18/2014  12/17/2015
 1/18/2015   1/17/2016
 2/18/2015   2/17/2016
 3/18/2015   3/17/2016
 4/18/2015   4/17/2016
 5/18/2015   5/17/2016
 6/18/2015   6/17/2016
 7/18/2015   7/17/2016
 8/18/2015   8/17/2016
 9/18/2015   9/17/2016
10/18/2015  10/17/2016
11/18/2015  11/17/2016
12/18/2015  12/17/2016
 1/18/2016   1/17/2017

如果您希望年份从当天开始:

=EOMONTH(NOW(),11) + DAY(NOW()) -1

如果您希望年份从当月的第一天开始:

=EOMONTH(EOMONTH(NOW(),-1) + 1,11)

=EOMONTH(NOW() - DAY(NOW()) + 1,11)

EOMONTH()函数:

EOMONTH(start_date,months)

Returns the serial number for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.

If this function is not available, and returns the #NAME? error, install and load the Analysis ToolPak add-in.

我认为您需要 EOMonth 公式。

=EOMONTH(NOW(),-13) +1=EOMONTH(NOW(),-2) +1 应该给你 JAN 2014 到 DEC 2014

来自 MS Excel 文档

Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900.

要获得您想要的文本格式,我建议您按照@Makyen 的建议坚持格式化 cell/column。话虽如此,这是您可以用来设置文本格式的公式。

=UPPER(TEXT(EOMONTH(NOW(),-13) +1, "MMM YY"))