Different combinations of cells should take a specific value

Aleksei

New Member
Joined
Jun 27, 2018
Messages
4
Hi all,

I have a column of data (10 cells) and I need to do the following: I want different combinations of cells in each following column take a value of "0". So in the first 10 columns - every different cell takes "0" value, then in the following columns there must be already 2 cells with "0" value (all the possible combinations of 10), then the number of "0" values in each combination increases to 3 and etc. (till 9 of them are equal to "0").
Do you guys know how one could do it in Excel? Is there maybe some formula or code in VBA?

Thank you in advance.

Best regads,
Aleksei
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi,

haha not really. I'm trying to do Mean-Variance Analysis. There I have to assign weight to each asset in a portfolio. My aim is to consider portfolios with all the possible combinations of assets. I want to gradually exclude assets from the list (assign "0" weight to them). That's what I'm doing :)
 
Upvote 0
I can't help you right now, am about to leave for a fortnight
A tip, try using the WorksheetFunction.COUNTIF() for each row and count the ocurrences of "0" or 0 that would help with the 2 3 4 etc allowed.
HAppy coding.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top