共享点,计算列,IF函数和日期 [英] Sharepoint, Calculated column, IF function and date

查看:63
本文介绍了共享点,计算列,IF函数和日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加计算列。

I am trying to add a calculated column.

我有一个date列,其中包含会议安排的日期。在此列中,我需要一个代码,如果会议是在Q1,Q2,Q3或Q4中安排的,则可以返回该代码。我有一个看起来像这样的静态代码:

I have a date column containing the date a meeting is scheduled. From this column I need a code which can return if the meeting is scheduled in Q1, Q2, Q3 or Q4. I have a static code looking like this:

'=IF(Date<40269;"Q1";"Q2-4")'   (40269 is the 1. April 2010 and Date=date-column)

但我需要一些帮助动态代码,它们也可以在明年计算相同的东西,而无需更改数字(40269)。我需要这样的东西:

But I need somekind of dynamic code which can calculate the same thing next year as well, without someone having to change the number(40269). I need something like this:

'=IF(Date<01-01-&year(today);"Q1";IF(Date<01-04-&year(today);"Q2";IF(Date<01-07-&year(today);"Q3";"Q4")))'

但是Sharepoint不接受这样写的日期01-01-2010,它需要一个数字,例如。 40269.上面的代码仅在今年有效,但是没关系,因为我将仅使用今年的数据。

But Sharepoint will not accept a date written like this 01-01-2010, it needs to be a number eg. 40269. The above code will only work correct for the present year, but thats all-right, since I will only use data from the present year.

有人可以帮助我吗? ?

Can anyone help me?

推荐答案

啊……比我预想的要容易。我使用了以下函数:

Ahhhh... It was easier than I had anticipated. I used this function:

=IF(MONTH(Date)<4;"Q1";IF(MONTH(Date)<7;"Q2";IF(MONTH(Date)<10;"Q3";"Q4")))

Date是包含会议日期的列。 month()返回月份号。例如,march = 3。

Date is a column containing the date of the meetings. month() returns the number of the month. E.g., march=3.

这篇关于共享点,计算列,IF函数和日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆