Choosing Options out of array

moshiq

New Member
Joined
Nov 18, 2013
Messages
9
Hi guys,

I have a problem that I find hard to solve and I will thank you for you advise:

-I have X options and I need to pick 3 out of them for 1st, 2nd and 3rd place.
-Each option is valued as: rate*place probability.
-If I chose option A in the 1st place it's unavailable for the 2nd and 3rd place
-I need the 3 highest (in rate*probability) combinations of those options.

here is an example of 5 options (it can varies):

Price1st Place2nd Place3rd Place
3100%40%20%
490%50%35%
2.580%50%40%
3.570%60%50%
560%20%40%

<colgroup><col><col><col span="2"></colgroup><tbody>
</tbody>

<colgroup><col><col><col><col span="2"></colgroup><tbody>
</tbody>

the solution to this example is:
1) B,D,E
2) D,B,E
3) B,A,E

What do you recommend I should do?
I prefer formula upon VBA.

Thanks
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I can understand nothing in the way this is written. Where are the options? What does rate have to do with your table? What does your solution choose?
 
Upvote 0
Hello Moshiq and welcome to the board.

I have to agree wtih C Moore, it is difficult to dechiper what you want here. From what you do have, it looks like something we can help you with, but you need to try a better explaination of what you need. You mention a couple thinks that are not in your table. If you can, please give another attempt at your problem and include all of the variables we need to consider.

Thank you
 
Upvote 0
Sorry guys for not being clear enough. I will try again from the beginning.

I have x amount of products. x is a variable between 1-10.
I can choose to present only 3 products (out of x) in a single offer.
I profit from each product, based on the place in the offer.

Here is an example for table of profit (based on x=5):

1st Place2nd Place3rd Place
Product A31.20.6
Product B3.621.4
Product C21.251
Product D2.452.11.75
Product E3.511

<tbody>
</tbody>

<tbody>
</tbody>

if I choose A,B and C:
the profit will be 3+2+1 = 6
changing the order of the offer will effect the profit:
B,A,C is 3.6+1.2+1 = 5.8
In this example the number of different offers are 60 (5*4*3).


Now, the solution I seek is optimization for the offers' profit.
Out of possible 60 offers I want to know what are the top 3 offers with the highest profit.

thank you for your help.
 
Upvote 0
Moshiq,

That does pose a bit of a challenge. Below see my solution for calculating the number and the list of the three products. Formulas are for data to be postioned at top left of spreadheet.

I am sure someone else could come up with a much better array formula or statisical formula, or a more creative/better way especially with code/VBA. My formula DOES NOT handle if there is a tie for any of the amounts in any column. It will select the first value that is the highest where the product has not already been used. I am not sure of your data or if there are other iterations where a lower value could be selelcted in column A or B to select different values in column B or C, if that makes sense. For that, I would think this should be handled by code. However, if the data you show is typical, I think the below method may work, except for handling a tie in the columns, which could certainly throw all of my formula solution off.

For the number calculation:

=MAX(B2:B6)+AGGREGATE(14,6,(B2:B6<>MAX(B2:B6))*C2:C6,1)+AGGREGATE(14,6,(B2:B6<>MAX(B2:B6))*(C2:C6<>AGGREGATE(14,6,(B2:B6<>MAX(B2:B6))*C2:C6,1))*D2:D6,1)

For the Product Names:

=CONCATENATE(INDEX(A2:A6,MATCH(MAX(B2:B6),B2:B6,0)),",",INDEX(A2:A6,MATCH(AGGREGATE(14,6,(B2:B6<>MAX(B2:B6))*C2:C6,1),C2:C6,0)),",",INDEX(A2:A6,MATCH(AGGREGATE(14,6,(B2:B6<>MAX(B2:B6))*(C2:C6<>AGGREGATE(14,6,(B2:B6<>MAX(B2:B6))*C2:C6,1))*D2:D6,1),D2:D6,0)))
 
Upvote 0
Okay, another attempt, using the first row values in order from highest to lowest to get the outcome. This is closer but still not perfect, I would think this would net the highest combination to pick the top three. Put this formula anywhere and copy down same number of rows in your table:

For the number calculation:

=LARGE($B$2:$B$6,ROW(A1))+AGGREGATE(14,6,($B$2:$B$6<>LARGE($B$2:$B$6,ROW(A1)))*$C$2:$C$6,1)+AGGREGATE(14,6,($B$2:$B$6<>LARGE($B$2:$B$6,ROW(A1)))*($C$2:$C$6<>AGGREGATE(14,6,($B$2:$B$6<>LARGE($B$2:$B$6,ROW(A1)))*$C$2:$C$6,1))*$D$2:$D$6,1)

For the Product Names:

=CONCATENATE(INDEX($A$2:$A$6,MATCH(LARGE($B$2:$B$6,ROW(A1)),$B$2:$B$6,0)),",",INDEX($A$2:$A$6,MATCH(AGGREGATE(14,6,($B$2:$B$6<>LARGE($B$2:$B$6,ROW(A1)))*$C$2:$C$6,1),$C$2:$C$6,0)),",",INDEX($A$2:$A$6,MATCH(AGGREGATE(14,6,($B$2:$B$6<>LARGE($B$2:$B$6,ROW(A1)))*($C$2:$C$6<>AGGREGATE(14,6,($B$2:$B$6<>LARGE($B$2:$B$6,ROW(A1)))*$C$2:$C$6,1))*$D$2:$D$6,1),$D$2:$D$6,0)))

Again copied down alongside the table anywhere

Please try and let me know. I still need to look at, and know an array formula will be the answer (although cose still the best option probably)
 
Upvote 0
For a small number of permutations (and even larger ones, as long as we are not in the millions) it seems easiest to me to calculate them all then take the largest. The check result on the formulas should be: E, B, D with a total of 7.25.

<a href="http://northernocean.net/etc/mrexcel/20140401_Book1.zip">SAMPLE WORKBOOK</a>
sha256 checksum (zip file): 3017976cf778f31a6c6604059ce1f50eb6c3a48775a051cb45099e1c15774610
 
Upvote 0
@joyner,
Thank you very much for your time and efforts.
I appreciate your formula.

but as @xenou said, the right answer is e,b,d which results 7.25
 
Upvote 0
For a small number of permutations (and even larger ones, as long as we are not in the millions) it seems easiest to me to calculate them all then take the largest. The check result on the formulas should be: E, B, D with a total of 7.25.

SAMPLE WORKBOOK
sha256 checksum (zip file): 3017976cf778f31a6c6604059ce1f50eb6c3a48775a051cb45099e1c15774610

Hi @xenou,

Thank you for your answer, I thought about it in the beginning, but I wanted to find a solution without writing all the possibilities.
one cell solution.
In any case, I'll take your answer and use it for my table.

thanks.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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