你只需要嵌套條件的每個IF()
塊的「假」部分。
舉個簡單的例子,想象一下,如果你只有兩個月。從概念上講,你的公式可能是這樣的:
IF([Month (Calculated)]="11", // if the column equals 11...
"November", // then display "November"
IF([Month (Calculated)]="12", // otherwise... if the column equals 12
"December", // then display "December"
"No date" // otherwise... display "No date"
)
)
它轉換爲下面一行公式:
IF([Month (Calculated)]="11","November",IF([Month (Calculated)]="12", "December","No date"))
現在只要這種做法擴展到所有十二個月,你會得到這樣一個公式:
IF([Month (Calculated)]="1", "January", IF([Month (Calculated)]="2", "February", IF([Month (Calculated)]="3", "March", IF([Month (Calculated)]="4", "April", IF([Month (Calculated)]="5", "May", IF([Month (Calculated)]="6", "June", IF([Month (Calculated)]="7", "July", IF([Month (Calculated)]="8", "August", IF([Month (Calculated)]="9", "September", IF([Month (Calculated)]="10", "October", IF([Month (Calculated)]="11", "November", IF([Month (Calculated)]="12", "December", "No date"))))))))))))
不幸的是,該公式超出了計算列公式的255個字符限制。爲了解決這個限制,你可以使用額外的計算列將公式分解成更小的部分。
一個如何打破了一個例子是如下:
計算的列1:(在端注意參考[Calculated Column 2]
)
IF([Month (Calculated)]="7","July",IF([Month (Calculated)]="8","August",IF([Month (Calculated)]="9","September",IF([Month (Calculated)]="10","October",IF([Month (Calculated)]="11","November",IF([Month (Calculated)]="12", "December",[Calculated Column 2]))))))
計算的列2 :
IF([Month (Calculated)]="1","January",IF([Month (Calculated)]="2","February",IF([Month (Calculated)]="3","March",IF([Month (Calculated)]="4","April",IF([Month (Calculated)]="5","May","No date")))))