简体   繁体   English

Excel数组公式IF(多个标准)

[英]Excel Array formula IF(multiple criteria)

In my spreadsheet, comparing headphones, our instruction is basically to use as many different formulas as possible. 在我的电子表格中,比较耳机,我们的指令基本上是使用尽可能多的不同公式。

So as part of the spreadsheet, I would like to be able to show the most expensive headphones per manufacturer , cheapest per manufacturer, best rated per manufacturer etc... So far I have been able to get some mostly working array formulas. 因此,作为电子表格的一部分,我希望能够显示每个制造商最昂贵的耳机, 每个制造商最便宜,每个制造商最佳评级等...到目前为止,我已经能够得到一些主要工作的数组公式。

For example, this formula works to get the model of the manufacturer "Sennheiser" with the highest price: 例如,此公式用于获得具有最高价格的制造商“Sennheiser”的模型

=INDEX($Data.$B$5:$L$32,SMALL(IF($Data.$E$5:$E$32 = $Sheet2.D17, ROW($Data.$B$5:$E$32) - ROW($Data.$B$5) + 1, ROW($Data.$E$32) + 1), 1), 2)

Column E is the Price column and D17 is a pre-calculated Max price for "sennheiser" E列是价格列,D17是“sennheiser”的预先计算的最高价格

This works fine, until you get 2 headphones with the same price / rating or whatever. 这很好,直到你得到2个相同价格/等级的耳机或其他什么。 THen it starts returning the wrong values. 然后它开始返回错误的值。

So I tried various solutions that I found on the interwebs, like 所以我尝试了在互联网上找到的各种解决方案,比如

AND(condition1, condition2) 
condition1 * AND(cndition2)
condition1 * condition2

but none of this seems to work with an array formula for some reason. 但由于某些原因,这似乎都不适用于数组公式。 I get #N/A or #VALUE and various other errors. 我得到#N / A或#VALUE以及其他各种错误。 SO basically I would like to know how to modify my formula, or even a completely new formula, to check for lowest price AND the correct manufacturer. 所以基本上我想知道如何修改我的公式,甚至是一个全新的公式,以检查最低价格和正确的制造商。

I hope my question is clear, so I have uploaded the spreadsheet to get some idea of what I am talking about. 我希望我的问题很清楚,所以我上传了电子表格,以便了解我在说什么。

http://dl.dropbox.com/u/18816338/Stats%20Analysis%20%20%281%29.xlsm http://dl.dropbox.com/u/18816338/Stats%20Analysis%20%20%281%29.xlsm

Thanks in advance 提前致谢

You can also use a simple formulas: 您还可以使用简单的公式:

=if( (Condition_A) * (Condition_B) * ... ; true; false) = if((Condition_A)*(Condition_B)* ...; true; false)

make sure to put the condition between parenthesis. 确保将条件置于括号之间。

Typically AND won't work here because AND returns a single result rather than an array....but * should be OK, ie try this formula in B3 通常AND在这里不起作用,因为AND返回单个结果而不是数组....但是*应该没问题,即在B3中尝试这个公式

=INDEX(Data!C$5:C$32,MATCH(1,(Data!$E$5:$E$32=$D3)*(Data!$B$5:$B$32=$A3),0))

confirmed with CTRL+SHIFT+ENTER and copied to C3 and then down both columns 用CTRL + SHIFT + ENTER确认并复制到C3然后向下两列

That will find the first match for both price and manufacturer and return the relevant model/type 这将找到价格和制造商的第一场比赛,并返回相关的型号/类型

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

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