Excel 逻辑表达式匹配问题
(我知道 Excel 只是边界编程)
我有一个数据块,表示流程中的步骤和可能的错误:
ProcessStep Status FeesPaid OK FormRecvd OK RoleAssigned OK CheckedIn Not Checked In. ReadyToStart Not Ready for Start
我想找到第一个不是“正常”的状态。
我尝试过这样做:
=Match("<>""OK""", StatusRange, 0)
它应该返回不等于(<>)范围内第一个元素的索引到“OK”
但这不起作用,而是返回#N/A
。
我希望它返回 4(索引 #4,在基于 1 的索引中,表示 CheckedIn 是第一个非 OK 元素)
有什么想法如何做到这一点?
(I understand Excel is only borderline programming)
I have a block of data that represents the steps in a process and the possible errors:
ProcessStep Status FeesPaid OK FormRecvd OK RoleAssigned OK CheckedIn Not Checked In. ReadyToStart Not Ready for Start
I want to find the first Status that is not "OK".
I have attempted this:
=Match("<>""OK""", StatusRange, 0)
which is supposed to return the index of the first element in the range that is NOT-EQUAL (<>) to "OK"
But this doesn't work, instead returning #N/A
.
I expect it to return 4 (index #4, in a 1-based index, representing that CheckedIn is the first non-OK element)
Any ideas how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这个问题和其他类似的问题是完全合法的编程问题(编辑:请参见此处:https://meta.stackexchange.com/questions/22922/which-site-do-excel-or-other-spreadsheet-formulas-belong-on/76767#76767< /a>)。 (不过,这可能是其他一些 StackOverflow 问题的重复。)
您想要使用数组公式:
您需要使用 Ctrl-Shift-Enter 将其输入为数组公式。
“MATCH”在范围或数组中查找值。将范围与标量进行比较(如“(StatusRange<>"OK")”中所示)会返回布尔值数组,因此您需要匹配“TRUE”值。
(您发布的公式正在查找值为 '<>"OK"' 的字符串文字...)
如果您最终想要 ProcessStep 列中的值,请查看 'INDEX' 或 'VLOOKUP 的帮助' 的功能。
I think this and other similar questions are completely legitimate programming questions (EDIT: see here: https://meta.stackexchange.com/questions/22922/which-site-do-excel-or-other-spreadsheet-formulas-belong-on/76767#76767). (It's probably a duplicate of some other StackOverflow question, though.)
You want to use an array formula:
You need to enter this as an array formula, with Ctrl-Shift-Enter.
'MATCH' finds a value in a range or an array. Comparing a range to a scalar, as in '(StatusRange<>"OK")', returns an array of boolean values, so you're looking to match a value of 'TRUE'.
(The formula you posted was looking for a string literal with the value '<>"OK"'...)
If you ultimately want the value in the ProcessStep column, look at the help for the 'INDEX' or 'VLOOKUP' functions.