我有A,B和C列。如果找到,D列将是添加配偶姓名的新列。联系人之间的共同信息是地址,所以这是我到目前为止的公式:
=IF(B3="Spouse", IF(INDEX(B:B, MATCH(C3,C:C, 0))="Primary", INDEX(A:A, MATCH(C3,C:C, 0)), ""), "No Spouse")
问题似乎与MATCH(C3,C:C, 0)
有关。 C3
单元格位于C:C
范围内。
A B C D
Name Relationship Address Spouse
Joe Smith Primary 432 Park Dr No Spouse
Michael Turner Primary 2298 Thompson Rd No spouse
Sarah Smith Spouse 432 Park Dr Joe Smith
Hannah Smith Child 432 Park Dr No Spouse
答案 0 :(得分:2)
使用此公式:
=IF(B2="Spouse","",IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($C$2:$C$4)/(($C$2:$C$4=C2)*($A$2:$A$4<>A2)),1)),"No Spouse"))
instructions for implementing a LifecycleOwner
根据您的新数据:
=IF(B2="Spouse",IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($C$2:$C$5)/(($C$2:$C$5=C2)*($A$2:$A$5<>A2)*($B$2:$B$5 = "Primary")),1)),"No Spouse"),"No Spouse")
答案 1 :(得分:0)
向后兼容性的替代公式(在单元格D2中并向下复制):
=IF(OR(COUNTIF(C:C,C2)=1,B2="Child"),"No Spouse",INDEX($A$2:$A$4,MATCH(1,INDEX(($C$2:$C$4=C2)*($A$2:$A$4<>A2),),0)))