Excel Question - Generate all combination?
1) How do I get excel to generate all combinations 1x10 vector with only 0s and 1s.
Ex: 1010100111, 0001000110, etc...
2) my spreadsheet takes the arrays above as an input and then computes a number. Using all of the combinations generated above, how do I get excel to calculate the result for each array generated?
Ex: Spreadsheet(1010100111) -------> 53
Spreadsheet(0001000110) -------> 127
etc.
.
.
For question #1, xelink has some great advice above. For question #2, I'm a bit confused by how you're calculating your numbers from your array. For instance, 1010100111 in binary is not 57, nor is 0001000110 equal to 127. Are you intending to assign random numbers to the arrays? Or perhaps some schema you've already developed but aren't divulging?
Another way to do this is with VBA where you could build out a function to perform the calculation. This is pretty easy and wouldn't take long to learn if you're unfamiliar with VBA.
once you have the decimal number in column A and the binary in column B, you can reference those using offset(match()) to find the correct decimal number for anything else you put in somewhere in the spreadsheet
Google on how to create your own workbook functions, it's very simple to do in VBA and there are lots of good tutorials out there.
Put 1-1024 in column A. Put this formula right next to it and copy down
=IF(A11024,1&DEC2BIN(A1-1,9),"1111111111"))
From what I can see that works. Now, like I said earlier, to be able to do spreadsheet(A57)= some number you are going to have to create a worksheet function in excel. Google it, lots of good tutorials.
xelink, the dec2bin has a length feature which really saved me a lot of work, just a heads up.
wtf repost. anyways
sorry about that. here is the correct formula
=IF(A11024,1&DEC2BIN(A1-512,9),"1111111111"))
Thank you guys for all the help! I wasn't able to finish the project as I found out excel isn't even powerful enough to calculate what I wanted. Still, I was able to learn a lot from the advice you guys gave.
basically my problem was to calculate the std dev of a N-sized portfolio from a pool of 30 stocks. There are just too many permutations for excel to handle. I'm thinking maybe matlab or mathematica might be better? some professional computational tool?
Aspernatur aut minus vel architecto tempore. Quibusdam eveniet voluptas accusantium reprehenderit aut possimus. Ut ipsam ut quas. Sit id impedit aspernatur mollitia. Id aut illo aut perferendis. Reprehenderit veniam odit cupiditate velit at culpa corrupti. Ipsa odit debitis nesciunt nostrum voluptas iste.
Sunt veritatis voluptatum quis et. Et repellendus atque eaque consequatur impedit. Voluptatem aut omnis provident soluta quisquam voluptate aut quam. Commodi temporibus corrupti qui cumque vel culpa. Magnam rerum dicta et.
See All Comments - 100% Free
WSO depends on everyone being able to pitch in when they know something. Unlock with your email and get bonus: 6 financial modeling lessons free ($199 value)
or Unlock with your social account...