OK. So it is a bit more complicated - we will need three keys sorting. See attachement and brief explanation:
I made a list of all vendors SKUs (copied column D into J, removed duplicates, sorted ascending) and assigned them numbers 1...361 (there is 361 unique SKUs) in column K.
Then in F2 I wrote number for this particular vendor SKU number
and in G2 smallest number for any vendor SKU in given orderNo (array formula *):
and copied both formulas down
Now the range A1:G3520 has to be sorted on 3 keys: smallest vendor SKU number for given order, order number, vendor SKU number (see picture - sort dialog is in Polish, but elements are located the same way in any national/international version of Excel).
Of course once rady you can get rid of all columns F:K
*) ...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.
Bookmarks