0

I want to create a list of possible results out of a set amount of numbers. See example below:

Numbers in list:

1
2
3

The result I would want here would be:

1+2+3
1+2
1+3
2+3
1
2
3

How would I go about generating these results using either Excel or Excel VBA?

Thank you in advance

Community
  • 1
  • 1
AJ C
  • 1
  • 1
    In the first case, do you want it to return the text "1+2+3" or the numeric value 6? – Alexis Olson Jul 27 '16 at 18:13
  • 2
    Also, are you always going to have just three numbers or do you need it to work for more too? (FWIW, the number of results grows like 2^n.) – Alexis Olson Jul 27 '16 at 18:25
  • See [Expanding column cells for each column cell](http://stackoverflow.com/questions/31472816/expanding-column-cells-for-each-column-cell/31594569#31594569) and include a blank with every value. –  Jul 27 '16 at 18:31
  • Thank you all for the responses. @AlexisOlson: I do not want it to return the number 6, I want it to return the combinations as 1+2=3 and 3=3... Only addition YowE3K. – AJ C Aug 03 '16 at 20:21
  • Ok a more detailed explanation to my basic question: I have 15-20 Invoices consisting of various amounts. I have 3 Cost centers. 1st Cost Center = 900000, 2nd Cost Center = 600000, 3rd Cost Center = 500000. I want the invoices to go into cost center 1, taking cost center 1 to the closest to 0 before going into cost center 2 taking it closest to 0 and then to cost center 3. So what I want is the breakdown of the invoices that goes to cost center 1, cost center 2 and cost center 3. Thank you – AJ C Aug 03 '16 at 20:25
  • @AJC I think I may understand. So your original question is part of a brute force attempt at solving a multi-stage [knapsack problem](https://en.wikipedia.org/wiki/Knapsack_problem)? Given that your n is around 20, brute force seems feasible. – Alexis Olson Aug 04 '16 at 03:35

0 Answers0