Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

=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"

This works fine, until you get 2 headphones with the same price / rating or whatever. 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. 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

Thanks in advance

like image 686
geniass Avatar asked Oct 13 '25 07:10

geniass


2 Answers

You can also use a simple formulas:

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

make sure to put the condition between parenthesis.

like image 52
Merwane Avatar answered Oct 15 '25 11:10

Merwane


Typically AND won't work here because AND returns a single result rather than an array....but * should be OK, i.e. try this formula in 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

That will find the first match for both price and manufacturer and return the relevant model/type

like image 39
barry houdini Avatar answered Oct 15 '25 10:10

barry houdini