Complicated IF()

Jon von der Heyden

MrExcel MVP, Moderator
Joined
Apr 6, 2004
Messages
10,907
Office Version
  1. 365
Platform
  1. Windows
Why won't this work?

=IF(AND(C1<={100;90;80;70},C1>={91;81;71;61}),{"A";"B";"C";"D"},"X")

Trying to return relevant {"A","B"....}, Many more conditions apply so trying to keep formula legnth down, or avoid huge lookup table.

Regards,
Jon
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I don't know the answer but you might try the formula watch window to get an idea where the formula breaks down.
 
Upvote 0
Hello,

The lookup table will be smaller and more efficient (binary) than your two-pronged, linear conditional. Try the following:

=LOOKUP(C1,{0,"X";61,"D";71,"C";81,"B";91,"A";101,"X"})
 
Upvote 0
Cool, thanks Nate, much better now.

Still curious though, why didn't my one work in the first instance?
 
Upvote 0
You're welcome.

Sorry, I don't see how it could work. I see what you're going for but Excel can't interpret that, it won't assume/implement an index location of the combinations without your telling Excel to do so.

You'd need to multiply booleans and use the index() of where there's a match of 1 against your return array. Should be a much more intensive calculation as you'd have to evaluate all possible combinations; go with Lookup().
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,382
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top