If Statement - Is there a better way?

lpost1214

New Member
Joined
Nov 9, 2016
Messages
6
I have been working on writing an if statement to lookup or index match values on another spreadsheet, but I have not been able to write something that will satisfy all of the criteria, therefore, looking for some help.

I am trying to looking a production quantity on a separate tab, where value in column L = 0. I would also like the formula to:

*If the first instance of 0in column L for the same item in column B, pull back the first production quantity listed as these will be sorted in chronological order.
*If not the first 0 for the same item, check whether the quantity pulled back for the line above will satisfy the open order quantity on the line above and the corresponding value in column I. If, not then pull back the next production quantity.
*If there is no corresponding production value on the lookup, then I would like to reflect a "0" or "no production".
*If the value in column L is greater than Zero or there is a break between items, I would like to return a blank

Here is what I have written so far, I seem to be running into issues getting all of these things to work together.

=IFERROR(IF(OR(VALUE(L4) > 0,A4=" "),"",IF(AND(VALUE(L4)=0,B3="Description"),VLOOKUP(B4,Sched!A:C,3,0),IF(B4=" ","",IF(AND(VALUE(L4)=0,VALUE(L3) <> 0),INDEX(Sched!C:C,MATCH(Detail!B4,Sched!A:A,0)),IF(AND(VALUE(L4)=0,VALUE(L3)=0,VLOOKUP(B4,Sched!A:C,3,0)-I3 < I4),INDEX(Sched!C:C,MATCH(Detail!B4,Sched!A:A,0)+1),INDEX(Sched!C:C,MATCH(Detail!B4,Sched!A:A,0))))))),"-")
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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