超过2个答案的Excel多语句

试图得到一个Excel电子表格来做我所需要的,而我的电脑基本上不识字。 任何帮助,将不胜感激基本上我需要的是下面的说法相结合

If E8 = Officer and G8 = Active Duty then 1 If E8 = Officer and G8 = Active Reserve then 2 if E8 = Enlisted and G8 = Active Duty then 3 If E8 = Enlisted and G8 = Active Reserve then 4 

我已经能够找出一些基本的,如果陈述,但这个有多个结果的是扔我一个循环,也都需要进入一个单元格,如果可能的话。 多谢你们

 =MATCH(E8&G8,{"OfficerActive Duty","OfficerActive Reserve","EnlistedActive Duty","EnlistedActive Reserve"},0) 

要么

 =(MATCH(E8,{"Officer","Enlisted"},0)-1)*2+MATCH(G8,{"Active Duty","Active Reserve"},0) 

这是你需要的:

 IF(AND(E8="Officer",G8="Active Duty"), 1, IF(AND(E8="Officer",G8="Active Reserve"), 2, IF(AND(E8="Enlisted",G8="Active Duty"), 3, 4))) 

如果将来需要使用它,最好将其设置为查找表,以下是如何使用数组公式(单击“ Ctrl + Shift + Enter” ):

 =INDEX($C$2:$C$5,MATCH(E2&F2,$A$2:$A$5&$B$2:$B$5,0),1) 

这样,您可以随时dynamic更新您的标准。

另外,您可以按照您的标准设置下拉列表( Data > Data Tools > Data Validation ):