Hi Excel Masters,
I am trying to list all the combinations of a qty X breakdown within a 2 dimensions tables.
In other words, lets imagine I have 1 unit of a product in stock, what are the combinations of destinations that I could send that product to (Clients x in Region Y)
Example 1:
Inputs : Qty 1 in stock in B1 for for below table starting A3(Clients / Regions)
[TABLE="width: 320"]
<colgroup><col style="width:48pt" width="64" span="5"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty[/TD]
[TD="width: 64, align: right"]1[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client1[/TD]
[TD]Client2[/TD]
[TD]Client3[/TD]
[TD]……[/TD]
[/TR]
[TR]
[TD]Region1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]….[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Outputs: in Col L 1 and M1
[TABLE="width: 173"]
<colgroup><col style="width:48pt" width="64"> <col style="width:82pt" width="109"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty1[/TD]
[TD="width: 109"]Region1 Client1[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region1 Client3[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region2 Client1[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region2 Client2[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region3 Client1[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region3 Client2[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region3 Client3[/TD]
[/TR]
</tbody>[/TABLE]
Example 2:
IF now we have qty 2 in B1, we have more combinations as 2 could be a combination of 2 or 1 and 1.
Input
[TABLE="width: 320"]
<colgroup><col style="width:48pt" width="64" span="5"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty[/TD]
[TD="width: 64, align: right"]2[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client1[/TD]
[TD]Client2[/TD]
[TD]Client3[/TD]
[TD]……[/TD]
[/TR]
[TR]
[TD]Region1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]….[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Output in L1
[TABLE="width: 353"]
<colgroup><col style="width:48pt" width="64"> <col style="width:217pt" width="289"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty2[/TD]
[TD="width: 289"]2 Region1 Client1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region1 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region2 Client1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region2 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region3 Client1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region3 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region3 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region1 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 2 Client1 / 1 Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 2 Client1 / 1 Region2 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 2 Client1 / 1 Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 3 Client1 / 1 Region3 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 3 Client1 / 1 Region3 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 3 Client1 / 1 Region3 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region 2 Client 1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region 3 Client 1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client 2 / 1 Region 2 Client 2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client2 / 1 Region 3 Client 2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client 3 / 1 Region 2 Client 3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client2 / 1 Region 3 Client 3[/TD]
[/TR]
</tbody>[/TABLE]
I would love to be able to use a VBA code in order to list all combinations for a any qty in B1 and more than 3 Regions and Clients.
This is defo one of the most difficult thing I have ever try to do in excel. I hope there is someone out there who can solve that.
Thanks in advance
I am trying to list all the combinations of a qty X breakdown within a 2 dimensions tables.
In other words, lets imagine I have 1 unit of a product in stock, what are the combinations of destinations that I could send that product to (Clients x in Region Y)
Example 1:
Inputs : Qty 1 in stock in B1 for for below table starting A3(Clients / Regions)
[TABLE="width: 320"]
<colgroup><col style="width:48pt" width="64" span="5"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty[/TD]
[TD="width: 64, align: right"]1[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client1[/TD]
[TD]Client2[/TD]
[TD]Client3[/TD]
[TD]……[/TD]
[/TR]
[TR]
[TD]Region1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]….[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Outputs: in Col L 1 and M1
[TABLE="width: 173"]
<colgroup><col style="width:48pt" width="64"> <col style="width:82pt" width="109"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty1[/TD]
[TD="width: 109"]Region1 Client1[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region1 Client3[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region2 Client1[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region2 Client2[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region3 Client1[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region3 Client2[/TD]
[/TR]
[TR]
[TD]Qty1[/TD]
[TD]Region3 Client3[/TD]
[/TR]
</tbody>[/TABLE]
Example 2:
IF now we have qty 2 in B1, we have more combinations as 2 could be a combination of 2 or 1 and 1.
Input
[TABLE="width: 320"]
<colgroup><col style="width:48pt" width="64" span="5"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty[/TD]
[TD="width: 64, align: right"]2[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Client1[/TD]
[TD]Client2[/TD]
[TD]Client3[/TD]
[TD]……[/TD]
[/TR]
[TR]
[TD]Region1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Region3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]….[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Output in L1
[TABLE="width: 353"]
<colgroup><col style="width:48pt" width="64"> <col style="width:217pt" width="289"> </colgroup><tbody>[TR]
[TD="width: 64"]Qty2[/TD]
[TD="width: 289"]2 Region1 Client1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region1 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region2 Client1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region2 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region3 Client1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region3 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]2 Region3 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region1 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region1 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 2 Client1 / 1 Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 2 Client1 / 1 Region2 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 2 Client1 / 1 Region2 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 3 Client1 / 1 Region3 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 3 Client1 / 1 Region3 Client2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 3 Client1 / 1 Region3 Client3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region 2 Client 1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client1 / 1 Region 3 Client 1[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client 2 / 1 Region 2 Client 2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client2 / 1 Region 3 Client 2[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client 3 / 1 Region 2 Client 3[/TD]
[/TR]
[TR]
[TD]Qty2[/TD]
[TD]1 Region 1 Client2 / 1 Region 3 Client 3[/TD]
[/TR]
</tbody>[/TABLE]
I would love to be able to use a VBA code in order to list all combinations for a any qty in B1 and more than 3 Regions and Clients.
This is defo one of the most difficult thing I have ever try to do in excel. I hope there is someone out there who can solve that.
Thanks in advance
Last edited: