是否有一种方法可以使用SP计算字段来计算"是"答案?

时间:2018-03-06 19:14:57

标签: sharepoint sharepoint-2010 sharepoint-2013

我在SharePoint列表中有二十六个字段/列,名为F01 - F26,它们是简单的下拉字段,可以是“是”或“否”。我正在尝试以编程方式计算F01 - F26设置为“是”的次数计算字段。

在过去,我使用以下内容来计算二十六个字段中有多少不是空白的:

=COUNTA(F01,F02,F03,F04,F05,F06,F07,F08,F09,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22,F23,F24,F25,F26) 

我尝试了这个但是失败了

IF([F01] = "YES", 1, 0)+ IF([F02] = "YES", 1, 0)+ IF([F03] = "YES", 1, 0)+ IF([F04] = "YES", 1, 0)+ IF([F05] = "YES", 1, 0)+ IF([F06] = "YES", 1, 0)+ IF([F07] = "YES", 1, 0)+ IF([F08] = "YES", 1, 0)+ IF([F09] = "YES", 1, 0)+ IF([F10] = "YES", 1, 0)+ IF([F11] = "YES", 1, 0)+ IF([F12] = "YES", 1, 0)+ IF([F13] = "YES", 1, 0)+ IF([F14] = "YES", 1, 0)+ IF([F15] = "YES", 1, 0)+ IF([F16] = "YES", 1, 0)+ IF([F17] = "YES", 1, 0)+ IF([F18] = "YES", 1, 0)+ IF([F19] = "YES", 1, 0)+ IF([F20] = "YES", 1, 0)+ IF([F21] = "YES", 1, 0)+ IF([F22] = "YES", 1, 0)+ IF([F23] = "YES", 1, 0)+ IF([F24] = "YES", 1, 0)+ IF([F25] = "YES", 1, 0)+ IF([F26] = "YES", 1, 0)

2 个答案:

答案 0 :(得分:0)

如果它们是Yes / No列,那么它们可以被视为0和1。

= F01 + F02 + F03 + F04 + ...

您没有说出错误是什么,但如果您使用的是选择列,并使用"是"和"不"值,错误来自公式的长度,试试这个:

=(F01="Yes")+(f02="Yes")+(f03="Yes") ...

每个布尔值"" true"被视为1。

答案 1 :(得分:0)

以下公式适用于我。

IF([F01] = "YES", 1, 0)+ IF([F02] = "YES", 1, 0)+ IF([F03] = "YES", 1, 0)+ IF([F04] = "YES", 1, 0)+ IF([F05] = "YES", 1, 0)+ IF([F06] = "YES", 1, 0)+ IF([F07] = "YES", 1, 0)+ IF([F08] = "YES", 1, 0)+ IF([F09] = "YES", 1, 0)+ IF([F10] = "YES", 1, 0)+ IF([F11] = "YES", 1, 0)+ IF([F12] = "YES", 1, 0)+ IF([F13] = "YES", 1, 0)+ IF([F14] = "YES", 1, 0)+ IF([F15] = "YES", 1, 0)+ IF([F16] = "YES", 1, 0)+ IF([F17] = "YES", 1, 0)+ IF([F18] = "YES", 1, 0)+ IF([F19] = "YES", 1, 0)+ IF([F20] = "YES", 1, 0)+ IF([F21] = "YES", 1, 0)+ IF([F22] = "YES", 1, 0)+ IF([F23] = "YES", 1, 0)+ IF([F24] = "YES", 1, 0)+ IF([F25] = "YES", 1, 0)+ IF([F26] = "YES", 1, 0)

enter image description here 我建议你提供错误信息以供进一步研究。