Instead of a bunch of nested IF statements...

StuartM1

Board Regular
Joined
Oct 6, 2010
Messages
115
Hi all,

What’s the best way to test each row in a large dataset tosee if it meets three criteria?
If cell A2 is “Blue” and the Expiration Date in B2 is 5/17/18, and C2 is a number, I need cell D2 to multiply the number in C2 by .3 per the table below.

And so on and so on for each row.

What’s the correct way to do this without having a huge combinationof IF statements?


Here’s a copy of the table with test criteria.

[TABLE="width: 375"]
<colgroup><col width="88" style="width: 66pt; mso-width-source: userset; mso-width-alt: 3218;"> <col width="109" style="width: 82pt; mso-width-source: userset; mso-width-alt: 3986;"> <col width="129" style="width: 97pt; mso-width-source: userset; mso-width-alt: 4717;"> <col width="86" style="width: 65pt; mso-width-source: userset; mso-width-alt: 3145;" span="2"> <tbody>[TR]
[TD="width: 88, bgcolor: #B4C6E7"]Color Code[/TD]
[TD="width: 109, bgcolor: #B4C6E7"]Expires after[/TD]
[TD="width: 129, bgcolor: #B4C6E7"]Expires before[/TD]
[TD="width: 86, bgcolor: #B4C6E7"]Discount[/TD]
[TD="width: 86, bgcolor: #B4C6E7"]Multiplier[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Blue[/TD]
[TD="bgcolor: transparent, align: right"]12/31/2000[/TD]
[TD="bgcolor: transparent, align: right"]8/15/2018[/TD]
[TD="bgcolor: transparent, align: right"]100[/TD]
[TD="bgcolor: transparent, align: right"]0.1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Blue[/TD]
[TD="bgcolor: transparent, align: right"]12/31/2000[/TD]
[TD="bgcolor: transparent, align: right"]6/30/2018[/TD]
[TD="bgcolor: transparent, align: right"]100[/TD]
[TD="bgcolor: transparent, align: right"]0.3[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Red[/TD]
[TD="bgcolor: transparent, align: right"]12/31/2000[/TD]
[TD="bgcolor: transparent, align: right"]6/30/2018[/TD]
[TD="bgcolor: transparent, align: right"]100[/TD]
[TD="bgcolor: transparent, align: right"]0.2[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Red[/TD]
[TD="bgcolor: transparent, align: right"]12/31/2000[/TD]
[TD="bgcolor: transparent, align: right"]6/30/2018[/TD]
[TD="bgcolor: transparent, align: right"]100[/TD]
[TD="bgcolor: transparent, align: right"]0.25[/TD]
[/TR]
</tbody>[/TABLE]





Any ideas would be appreciated!!
Thanks!!!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Maybe this is a better visual:

[TABLE="width: 584"]
<tbody>[TR]
[TD]Color[/TD]
[TD]Expires[/TD]
[TD]Number[/TD]
[TD]Product[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD]5/17/2018[/TD]
[TD]600[/TD]
[TD="colspan: 3"]Multiply 600 * .3 from table below[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Color Code[/TD]
[TD]Expires after[/TD]
[TD]Expires before[/TD]
[TD]Multiplier[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD="align: right"]12/31/2000[/TD]
[TD="align: right"]8/15/2018[/TD]
[TD="align: right"]0.1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD="align: right"]12/31/2000[/TD]
[TD="align: right"]6/30/2018[/TD]
[TD="align: right"]0.3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Red[/TD]
[TD="align: right"]12/31/2000[/TD]
[TD="align: right"]6/30/2018[/TD]
[TD="align: right"]0.2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Red[/TD]
[TD="align: right"]12/31/2000[/TD]
[TD="align: right"]6/30/2018[/TD]
[TD="align: right"]0.25[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Thanks for the clarification...


Book1
ABCD
1ColorExpiresNumberProduct
2Blue5/17/201860060
3
4
5
6
7
8Color CodeExpires afterExpires beforeMultiplier
9Blue12/31/20008/15/20180.1
10Blue12/31/20006/30/20180.3
11Red12/31/20006/30/20180.2
12Red12/31/20006/30/20180.25
Sheet1


In D2 control+shift+enter, not just enter:

=IFERROR(INDEX($D$9:$D$12,MATCH(A2,IF(B2>=$B$9:$B$12,IF(B2<=$C$9:$C$12,$A$9:$A$12)),0))*C2,"not available")
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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