英文:
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:
- two zips do not match and adjacent (wont ever be residing) - new column would be blank (eg row 3)
- Two zips match and residing but also have matches that are adjacent- want those to be keep (eg row 1)
- Two zips match and = adjacent but also have a residing match- want those to be labeled "remove" (eg row 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="居住"),"保留",""))
示例结果:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论