if-statement - SharePoint 2010 列表、计算列、If 语句修改不起作用
问题描述
我在计算列中有一个公式,效果很好。我试图修改公式,重用之前工作的部分内容(粗体),但它一直把我带到语法错误屏幕。新公式要简单得多。
我上网查了一下,没找到问题。
--旧公式(有效):
=IF(AND(LEFT([EVENT TYPE],8)<>"Mtng (PM",LEFT([EVENT TYPE],8)<>"Mtng (eP",LEFT([EVENT TYPE],8)<> "Mtng (DS",LEFT([EVENT TYPE],8)<>"Mtng (#D"),"N/A for this row", IF(OR([(DC1) EDS?]="",[ (DC2) Part Info]="",[(DC3) Part Innov]="",[(DC4) Other]=""),"填充 DC 列 (1-4)",IF(OR(LEFT([ (DC1) EDS?],1)<>"4",LEFT([(DC2) Part Info],1)<>"4",LEFT([(DC3) Part Innov],1)<>"4" ,LEFT([(DC4) 其他],1)<>"4"),"是","否")))
--新公式(抛出错误)- 完全从旧公式复制的粗体部分:
=IF(AND(LEFT([EVENT TYPE],8)<>"Mtng (PM",LEFT([EVENT TYPE],8)<>"Mtng (eP",LEFT([EVENT TYPE],8)<> "Mtng (DS",LEFT([EVENT TYPE],8)<>"Mtng (#D"), "N/A for this row", [添加到数据收集日历?])
修改后的公式(粗体)中的语法和条件直接来自旧公式。如果条件为假,我只希望公式输入“添加到”列的内容,而不是添加其他 If 语句。
“添加到...”列是选择列。
条件中提到的“事件类型”列也是选择列。(此条件在旧的、更长的公式中正确评估)。
我试图将计算列设置为简单的“= [添加到数据收集日历?]”以检查“添加到...”列是否存在问题,但该公式有效并让我得到“添加”的内容到……”栏目。
它必须是一些我似乎找不到的简单的东西。
更新(2019 年 6 月 3 日)我在 Excel 中输入了新公式,为 [EVENT TYPE] 和 [Add to Data Collection Calendar?] 添加了两列,公式语法工作正常,可以提供准确的输出:
=IF(AND(LEFT(A4,8)<>"Mtng (PM",LEFT(A4,8)<>"Mtng (eP",LEFT(A4,8)<>"Mtng (DS",LEFT(A4,8)<>"Mtng (#D"), "N/A for this row", C4)
由于旧公式有效,我认为我不需要这样做,但仍然测试将公式设置为“= [EVENT TYPE]”并出现语法错误!所以问题出在 EVENT TYPE 列上。为什么同一列在以前的公式中运行良好时会出现错误?(EVENT TYPE 是一个选择列,带有用于单项选择的下拉菜单)。
解决方案
Solved: This is bizarre on more than one level.
I found a solution from a post by someone whose column was named exactly the same "EVENT TYPE". The solution offered by someone (link below) was to remove the space between the two words to make it "EventType". I added an underscore instead, and IT WORKED!
The strange part is, the other column in the formula "Add to Data...." works fine with all the spaces. The square brackets are suppose to take care of spaces in any case.
Perhaps "EVENT TYPE" has keyword/s that triggered the issue. But again, they worked fine in previous formula. Perhaps simply changing the column name corrected for something, like rebooting works for some Excel issues?!
Solved by using this link: https://sharepoint.stackexchange.com/questions/86548/unable-to-add-a-choice-field-to-a-calculated-field-sharepoint-foundation-2013
推荐阅读
- amazon-web-services - 在 Cognito 用户池中注册时如何检查用户是否已经存在具有相同的电子邮件或电话号码
- bash - 使用 awk 命令解析 /etc/passwd 而不为每一行创建输出文件并从那里读取
- r - 维恩图未在 highcharter 包中呈现
- angular - matTreeNodeDef 迭代上的角垫树无法从 ngfor 获取索引
- c++ - 控制一个字符串是否存在于另一个字符串中(在 C++ 中)
- python - 命令“python setup.py egg_info”在/tmp/pip-build-tu6ygqzj/mysql-python/中失败,错误代码为1
- docker - 如何使用 docker-compose 构建 docker 镜像
- java - 如何使用名称中的增量值以编程方式实例化新的 JSONObject
- javascript - POST 加载时显示 JAVASCRIPT 的问题
- c++ - 如何使 getline 命令在 while 循环中工作?