Countries selection

Copper Contributor

Hello 

I have an Excel dataset containing data for 9 countries. I would like to generate all possible combinations of 4 countries from this dataset and save each combination in a separate folder named after the corresponding countries. Could you please advise me on the best approach to accomplish this task?

1 Reply

@QuantGuru 

Although my knowledge is limited in this direction, here is some information that might help you.

One way to accomplish this task is to use a combination formula in Excel to generate all possible combinations of 4 countries from the dataset. Then, you can use a macro or a script to create a new folder for each combination and name it after the corresponding countries. You can also use the macro or script to save the data for each combination in the respective folder.

 

Here’s some information on both using the combination formula and creating a macro or script:

To use the combination formula in Excel, you can use the COMBIN function. This function takes two arguments: the total number of items and the number of items to choose. For example, to find all possible combinations of 4 countries from a dataset of 9 countries, you can use the formula =COMBIN(9,4).

 

If you want to use only VBA to accomplish your task, you can write a macro or script to generate all possible combinations of 4 countries from your dataset and create a new folder for each combination.