My spreadsheet contains in *column A* a list of items and in *column B* the quantity of each item:

```
Column A Column B
110 30
220 30
380 60
```

I would like to display in a new cells the following logic:

If the *minimal item value* (**110** for the start) is still available in quantity of 20, use minimal value.

If *not* then use then use the **next** minimal value on the list (also provided its quantity is more than 20) and so on.

As a result, it should show in a new array: 110 (10 times), 220 (10 times), 380 (40 times).

I used the formula below to identify the minimal value needed as a next entry

```
=VLOOKUP(MIN(A1:A3),A1:B3,2,0)
```

Lets say 110, 220 and 380 are items (voltage sockets, for example). The column B are the quantities. The stock has to issue the smallest voltage sockets first until its quantity reaches the minimal required quantity that must be always maintained in stock (20). Pulling C1 down, the order of issue of such sockets would be 10x110v (as only 10 can be issued out of 30), then 10x220V (as 220v qty on stock will also become 20) and then issue the 380v ones. what would be the ideal formula for C1 in order to pull that formula down the Column C and the sequence automatically to become 110, 110, 110, ... as it reaches 10 items and becomes 20 in stock, Cell C11 would show its time to start issuing 220v sockets, and cell C21 should show 380, as the previous sockets reach the issuing maximum quantities.

Any ideas, please?