Index Match variable value - greater than less than question

karcpr

New Member
Joined
Sep 21, 2011
Messages
13
Hi everyone,
I have been doing greater than less than in a HUGE nested AND function, however, I understand that there is a very simple way to do a index + match that will capture greater than (or equal) / less than (or equal). Can you help me to ID if this formula exists? See below for a sample example.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

cost 1cost 2cost 3cost 4cost 5cost 6cost 7break 1break 2break 3break 4break 5break 6break 76 month demand
0.80.50.30.10.050.0350.03 1,000 2,500 5,000 10,000 25,000 500,000 100,000 3,500
0.0950.070.060.050.040.030.025 1,000 2,500 5,000 10,000 25,000 500,000 100,000 5,800

<tbody>
</tbody>
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
You haven't specified what you are trying to accomplish in your sample data....
 
Upvote 0
Sorry for the misdirection. :p

My goal is to find where the 6 month demand falls into the break column and as result come up with the cost that is associated with it. Break 1 is associated with cost 1, break 2 = cost 2 and so on.

In the old way of doing everything this is what I am trying to get (these would be nested into each other).

BREAK 1
IF(6 MONTH DEMAND < BREAK 2, COST 1,)

BREAK 2
IF(AND(6 MONTH DEMAND BREAK 2)),COST 2,)

BREAK 3
IF(AND(6 MONTH DEMAND BREAK 3)),COST 3,)

BREAK 4
IF(AND(6 MONTH DEMAND BREAK 4)),COST 4,)

BREAK 5
IF(AND(6 MONTH DEMAND BREAK 5)),COST 5,)

BREAK 6
IF(AND(6 MONTH DEMAND BREAK 6)),COST 6,)

BREAK 7
IF(6 MONTH DEMAND>BREAK 7,COST7,)
 
Upvote 0
I have to run, so haven't tested this, but this should get you close:

=INDEX(A1:G1,,IFERROR(MATCH(O1,H1:N1,1),1))

where A1:G1 is cost, O1 is demand lookup, and H1:N1 is demand breaks.
 
Upvote 0
That is great. What function does the Iferror play? I know what iferror does, however, how does the iferror differentiate the part?

I have an addition to the question on this process but I will start start a new thread.
 
Upvote 0
Match is used with the 1 flag here, which means it is in "find the smallest match" mode. However, it will error out if you enter a value smaller than your first demand break. Your first break is at 1,000, so if you try to look up 750 you will get an error. I assumed everything below 1,000 should return the same break as 1000-2499, so IFERROR(xxx,1) will return the value 1 in this case, and when you pass 1 to the INDEX function, it will return the first cost break.

If that logic is not correct, we'll either need to change the formula or have you add a zero demand cost break.
 
Upvote 0
Okay, here is a quick change in the thought process. This is how the pricing file usually looks when it is transmitted over to us.

Cost1Cost2Cost3Cost4Cost5Cost6Max Qty1Max Qty2Max Qty3Max Qty4Max Qty5Max Qty66 MONTHS SUPPLY
3.592.491.821.721.681.634999992499499999999999999 499
42.9936.5131.2122.9721.7921.249992494999999999999 69
0.45530.40090.36020.3330.29220.27869999199994999999999249999999999999 21,898
0.0740.071400004999999999990000 106,418
0.09990.086400002499999999990000 26,584
4.743.743.212.852.370999499999992499999999990 1,954
1.441.340000499999999990000 2,462
1.811.691.5700099949999999999000 6,000
2.552.021.891.76004999994999999999900 2,391
0.08060.069700002499999999990000 22,796
0.08150.0750.070700024999499999999999000 48,800
0.08390.072500002499999999990000 137,500
0.14040.132000024999999999990000 29,805
0.0790.07280.068600024999499999999999000 34,861
0.062700000999999900000 1,259,500

<colgroup><col span="6"><col span="5"><col><col></colgroup><tbody>
</tbody>


This is the format that everything currently is in. My issue is that I can manipulate the data to the min qtys and take out the 0's but when we are working on monsterous files, it makes it extremely time consuming. Do you know of a way that we can use the same formula and instead of using the pricing prior, you use the pricing max? The 6 month supply would still be what you are trying to get to.

To add complexity to the matter, would it be out of the realm of crazy to add a tolerance to the 6 month supply to state "if the 6 month supply is within x% of the next break, go to the next break. I theoretically could make a new column that that has an if function that states if 20% more is not the same break as the 6 month supply, to do the same formula. Does that make sense?
 
Upvote 0

Forum statistics

Threads
1,215,836
Messages
6,127,179
Members
449,368
Latest member
JayHo

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