Excel条件语句 – 2个单元格相等时,根据另一个单元格的值保留其中一个。

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

Excel Conditional Statement - 2 cells equal keep 1 based on value of another

问题

以下是代码部分的翻译:

=IF(D2=B2,IF(F2="Residing","Keep","Discard"),"")

请注意,这是你提供的Excel公式,用于根据条件生成新列中的值。不包括翻译部分。

英文:

Hi I am looking for help writing an if statement in excel. I have a data set containing zip codes, and a residing/adjacent column. I would like to create a new column that contains either blanks, keep, remove based on the below conditions.

My current statement works for the 'keep' but does nothing else =IF(D2=B2,IF(F2= "Residing", "Keep", "Discard"),"") Below is some sample data.
Possibilities:

  1. two zips do not match and adjacent (wont ever be residing) - new column would be blank (eg row 3)
  2. Two zips match and residing but also have matches that are adjacent- want those to be keep (eg row 1)
  3. Two zips match and = adjacent but also have a residing match- want those to be labeled "remove" (eg row 2)

Excel条件语句 – 2个单元格相等时,根据另一个单元格的值保留其中一个。

Any suggestions would be greatly appreciated!

答案1

得分: 0

尝试以下公式:

=IF(AND(A2=B2,C2="相邻",COUNTIFS(A:A,A2,B:B,B2,C:C,"居住")>0),"删除",IF(AND(A2=B2,C2="居住"),"保留",""))

示例结果:

Excel条件语句 – 2个单元格相等时,根据另一个单元格的值保留其中一个。

英文:

Try the following formula:

=IF(AND(A2=B2,C2="Adjacent",COUNTIFS(A:A,A2,B:B,B2,C:C,"Residing")>0),"Remove",IF(AND(A2=B2,C2="Residing"),"Keep",""))

Sample result:

Excel条件语句 – 2个单元格相等时,根据另一个单元格的值保留其中一个。

huangapple
  • 本文由 发表于 2023年3月3日 23:57:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629292.html
匿名

发表评论

匿名网友

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

确定