In D2 enter this array formula and copy down
=IFERROR(INDEX($C$2:$C$11,MATCH(0,IF(B$2:B$11>0,"",COUNTIF(D$1:$D1, $C$2:$C$11)),)),"")
...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
Row\Col A B C D 1ITEM QTY LOCATION 2Item 1 -1Location 1 Location 1 3Item 2 1Location 2 Location 3 4Item 3 -1Location 3 Location 2 5Item 4 1Location 3 6Item 5 -1Location 3 7Item 6 1Location 3 8Item 7 -1Location 3 9Item 8 1Location 4 10Item 9 -1Location 2 11Item 10 1Location 3
Bookmarks