Excel公式获取季节名称?

时间:2016-06-20 18:21:27

标签: excel date excel-formula

我的任务是使用公式从Excel中的日期获取季节名称。

到目前为止,由于此链接,我实现了从Date获得月份名称:

http://dedicatedexcel.com/how-to-convert-a-date-into-a-month-name-in-excel-2010/

在Excel公式中是否有(如switch-case),所以我可以根据月份名称获取季节名称?

感谢。

3 个答案:

答案 0 :(得分:7)

您可以使用Choose()函数。恰好在一个赛季开始时可能会有争议。这个公式假设季节从月初开始,而不是至日和春分日。

enter image description here

B2中北半球的公式是

=CHOOSE(MONTH(A2),"Winter","Winter","Spring","Spring","Spring","Summer","Summer","Summer","Autumn","Autumn","Autumn","Winter")

C2中南半球的公式是

=CHOOSE(MONTH(A2),"Summer","Summer","Autumn","Autumn","Autumn","Winter","Winter","Winter","Spring","Spring","Spring","Summer")

如果您希望季节在冬至和昼夜平分点开始,那么将其用于北半球:

=IF(DAY(A2)<22,CHOOSE(MONTH(A2),"Winter","Winter","Winter","Spring","Spring","Spring","Summer","Summer","Summer","Autumn","Autumn","Autumn","Winter"),CHOOSE(MONTH(A2),"Winter","Winter","Spring","Spring","Spring","Summer","Summer","Summer","Autumn","Autumn","Autumn","Winter"))

enter image description here

答案 1 :(得分:2)

季节有两种定义;天文季节(AS)和气象季节(MS)。 AS依赖于昼夜平分点和至日。即他们从21个月开始。虽然MS更容易进行天气预报,所以它们从1个月开始。 季节也取决于地点(半球的北部或南部)。 以下是日期和相应季节,具体取决于地点和方法:

     Season at 
(Northern/Southern) 
    Hemisphere                Astronomical             Meteorological
Winter / Summer              21/12 to 20/03            01/12 to end/02
Spring / Fall*               21/03 to 20/06            01/03 to  30/05
Summer / Winter              21/06 to 20/09            01/06 to  31/08             
Fall*  / Spring              21/09 to 20/12            01/09 to  31/01

在Excel中,我们可以通过以下公式获得日期(DOY): 例如,如果将日期存储在单元格G5中,则DOY =

=G5-DATE(YEAR(G5),1,1)

对于(AS):21 / 03,21 / 06和21/09的相应DOY为80,172,264

对于(MS):01 / 03,01 / 06和01/09的相应DOY为60,152,244

虽然上面的选择公式非常棒,但我会在简单的条件下编写它,以便轻松转换为任何编程语言。

示例: 北半球天文季节计算如下:

=if((DOY<80,"Winter",iF(DOY<"Spring",172,iF(DOY<264,"Summer","Fall")))

要计算南半球的季节或气象方法,可以使用上表轻松修改方程式。

  • 秋天在世界某些地方被称为秋天

答案 2 :(得分:1)

假设月份名称在A1中,而冬季从1月开始,请使用:

=IF(MONTH(DATEVALUE(A1 & " 1"))<4,"Winter",IF(MONTH(DATEVALUE(A1 & " 1"))<7,"Spring",IF(MONTH(DATEVALUE(A1 & " 1"))<10,"Summer","Autumn")))