# Index+Match/Index+Small

#### Mrbellav

##### New Member
So I have a workbook with two sheets

Sheet 1 (Demand)

Has a table of all of the items on the sales for a specific date and the quantities.
Column A= Item #
Column B=Sales order #
Column C=Date of sales order
Column D=Qty of Item on order

 Items Sales # Date Qty Item 1 SO#1 9/1/18 5 Item 2 SO#1 9/1/18 2 Item 3 SO#1 9/1/18 7 Item 2 SO#2 9/1/18 2 Item 3 SO#2 9/1/18 3 Item 1 SO#3 9/1/18 1 Item 4 SO#4 9/1/18 10 Item 5 SO#4 9/1/18 6 Item 1 SO#4 9/1/18 5

<tbody>
</tbody>

Sheet two (Inventory)

This sheet has a list of items, the total demand of the item across all sales orders. And the total on hand inventory of each Item, then the difference in amount. (I have this set up to only show my negative amounts, I have a sheet with all and a sheet of just negatives)
-Function I'm looking for will only go on the sheet with negatives.

Column A= Item #
Column B=Total Demand
Column C=Inventory
Column D=Difference

 Items Total Demand Inventory (On Hand) Product Needed Item 1 11 10 -1 Item 2 4 5 1 Item 3 10 5 -5 Item 4 10 10 0 Item 5 6 3 -3

<tbody>
</tbody>

I already have a macro to move these Negative rows to a different sheet working correctly.

Sheet 3 Product Needed
Column a=Item#
Column B=Total Demand
Column C=Inventory
Column D=Product Needed

 Items Total Demand Inventory Product Short Item 1 11 10 -1 Item 3 10 5 -5 Item 5 6 3 -3

<tbody>
</tbody>

So what I'm looking for is a function to tell me all of the sales order number that will potentially be short.
Ex... Item 1, SO#1, SO#3, SO#4

What I have tried so far is a array:
Index(Sheet1'!B2:B10,match(0,if(\$g\$1=Sheet'!A2:A10,countif(\$G\$1:G1,Sheet1'!a2:a10).""),0))

Also tried an..
Index( x, small(if( row()-min(row(), rows())

Could not get this to work. I know I can use a pivot table, but would like to find it another way let me know if anyone has any ideas!

### Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Replies
2
Views
45
Replies
9
Views
147
Replies
2
Views
45
Replies
2
Views
41
Replies
6
Views
65