如果数值在一个单元格中不匹配,那么在另一个单元格中显示它。

huangapple go评论72阅读模式
英文:

If value does not match in a cell then show it in another cell

问题

我有一个Google表格,其中包含多个代码。在一个单元格中可能有多个代码,而在另一个单元格中,用户选择的决策后跟随着代码。

对于给定的代码,响应是固定的。

我希望表格能够在另一列中显示用户选择的代码是否正确或错误(如果正确,则保留单元格为空,否则显示用户选择的错误代码)。

条件如下:

情况1:如果在A列中显示的代码是"P"或"W",则用户的决策(B列)应该是"NO"或"YES",而用户选择的代码(C列)应该是"N"(如果决策是"NO")或"R"(如果决策是"YES"),然后在D列中,如果决策和代码匹配,则保留单元格为空,否则显示用户选择的错误代码。

情况2:如果在A列中显示的代码不包含单元格中的"P"或"W"代码,则用户的决策(B列)应该是"NO",而用户选择的代码(C列)应该是"IM",然后在D列中,如果决策和代码匹配,则保留单元格为空,否则显示用户选择的错误代码(注:此条件可以创建在另一列中)。

我附上了一个屏幕截图以供参考。我尝试过各种公式,但都没有成功。

谢谢。

如果数值在一个单元格中不匹配,那么在另一个单元格中显示它。

英文:

I have a Google Sheet in which there are multiple codes. In one cell there is more than one code and in the other cell, the decision selected by the user is followed by the code.

Responses are fixed for the given codes.

I want the sheet to show if the codes selected by the users are wrong or correct in another column (if correct then leave the cell blank else to show the code selected by the user i.e the wrong code).

The conditions are:

Case 1: if the code displayed in column A is either "P" or "W" then the user's decision (column B) should be either "NO" or "YES" and the code (column C) selected by the user should be either "N" (if the decision is "NO") or "R" (if the decision is "YES") then in column D if the decision and code matches then leave the cell blank else to show the wrong code selected by the user.

Case 2: if the code displayed in column A does not have "P" or "W" code in the cell then the user's decision (column B) should be "NO" and the code (column C) selected by the user should be "IM" then in column D if the decision and code matches then leave the cell blank else to show the wrong code selected by the user. (P.S.: this condition can be created in another column).

如果数值在一个单元格中不匹配,那么在另一个单元格中显示它。

I'm sharing a screenshot for reference. I searched for a formula but nothing worked.

Thank you.

答案1

得分: 1

=indeX(lambda(regX,if(len(A2:A),
IF((regX*(B2:B="NO")(C2:C="N"))+
(regX
(B2:B="YES")(C2:C="R"))+
(not(regX)
(B2:B="NO")*(C2:C="IM")),,C2:C),))
(regexmatch(A2:A,"\b(P|W)\b)")
如果数值在一个单元格中不匹配,那么在另一个单元格中显示它。

英文:

You may try:

=indeX(lambda(regX,if(len(A2:A),
                               IF((regX*(B2:B="NO")*(C2:C="N"))+
                                  (regX*(B2:B="YES")*(C2:C="R"))+
                                  (not(regX)*(B2:B="NO")*(C2:C="IM")),,C2:C),))
      (regexmatch(A2:A,"\b(P|W)\b")))

如果数值在一个单元格中不匹配,那么在另一个单元格中显示它。

huangapple
  • 本文由 发表于 2023年2月19日 02:37:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75495546.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定