简体   繁体   English

跨工作表的Excel公式:如果a = x,b = y,则c = z

[英]Excel Formula across worksheets: If a=x, b=y then c=z

I started off using 我开始使用

=IF(AND(A1="this",B1="that"),"x","")

=IF(AND('[Employee Emails.xlsx]Alpha Order'!$A$2=A2,'[Employee Emails.xlsx]Alpha Order'!$B$2=B2, ???? > THEN I want it to pull the next cell '[Employee Emails.xlsx]Alpha Order'!$C$2 into C2. So C2 would display the email address. = IF(AND('[[Employee Emails.xlsx] Alpha Order'!$ A $ 2 = A2,'[[Employee Emails.xlsx] Alpha Order'!$ B $ 2 = B2,????>然后我要它拉下一个单元格“ [Employee Emails.xlsx] Alpha Order”!$ C $ 2进入C2,因此C2将显示电子邮件地址。

Hopefully if firstname & lastname match, then it pulls the email address into the new cell. 希望如果名字和姓氏匹配,那么它将电子邮件地址拉到新的单元格中。 Otherwise I have to manually look them up & copy & paste into the new workbook. 否则,我必须手动查找它们并复制并粘贴到新工作簿中。

I think this is what you want: 认为这是您想要的:

=IF(AND('[Employee Emails.xlsx]Alpha Order'!$A$2=A2,'[Employee Emails.xlsx]Alpha Order'!$B$2=B2), '[Employee Emails.xlsx]Alpha Order'!$C$2,"")

Though you may also want to look into VLOOKUP and INDEX/MATCH 虽然您可能还想研究VLOOKUPINDEX/MATCH

If this were your data: 如果这是您的数据:

    A   B   C  D E  F G
1   A   G   1    A  G
2   B   H   2    C  I
3   C   I   3    D  K
4   D   K   4           
5   E   L   5           
6   F   M   6           

In G1 you'd need this array formula (applied with Ctrl + Shift + Enter ): G1您需要以下数组公式(与Ctrl + Shift + Enter一起应用 ):

=INDEX($D$1:$D$6,MATCH(F1&G1,$B$1:$B$6&$C$1:$C$6,0))

And it would produce this: 它将产生以下结果:

    A   B   C  D E  F G
1   A   G   1    A  G 1
2   B   H   2    C  I 3
3   C   I   3    D  K 4
4   D   K   4           
5   E   L   5           
6   F   M   6           

Hopefully you'll find this helpful. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM