#1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sum of combinations

Hi,

I need help to approach a problem of this kind:
I have 4 products: A, B, C, D. I have to fix their prices.
Possible prices of product A: pa1, pa2, pa3, pa4.
Possible prices of product B: pb1, pb2, pb3.
Possible price of product C: pc1.
Possible prices of product D: pd1, pd2.

I want to get all possible revenues of sales of the products.

example
combin 1: pa1+pb1+pc1+pd1
combin 2: pa2+pb1+pc1+pd1
combin 3: pa3+pb1+pc1+pd1
combin 4: pa4+pb1+pc1+pd1
.....


thanks
p.

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Sum of combinations

Here are the combinations...
PA1 + PB1+ PC1 + PD1
PA1 + PB1+ PC1 + PD2
PA1 + PB2+ PC1 + PD1
PA1 + PB2+ PC1 + PD2
PA1 + PB3+ PC1 + PD1
PA1 + PB3+ PC1 + PD2
PA2 + PB1+ PC1 + PD1
PA2 + PB1+ PC1 + PD2
PA2 + PB2+ PC1 + PD1
PA2 + PB2+ PC1 + PD2
PA2 + PB3+ PC1 + PD1
PA2 + PB3+ PC1 + PD2
PA3 + PB1+ PC1 + PD1
PA3 + PB1+ PC1 + PD2
PA3 + PB2+ PC1 + PD1
PA3 + PB2+ PC1 + PD2
PA3 + PB3+ PC1 + PD1
PA3 + PB3+ PC1 + PD2
PA4 + PB1+ PC1 + PD1
PA4 + PB1+ PC1 + PD2
PA4 + PB2+ PC1 + PD1
PA4 + PB2+ PC1 + PD2
PA4 + PB3+ PC1 + PD1
PA4 + PB3+ PC1 + PD2

....and here is the code that generates them:
Sub Combinations()
Dim PA As Byte
Dim PB As Byte
Dim PD As Byte

For PA = 1 To 4
For PB = 1 To 3
For PD = 1 To 2
ActiveCell.Value = "PA" & PA & " + PB" & PB & "+ PC1 + PD" & PD
ActiveCell.Offset(1, 0).Select
Next PD
Next PB
Next PA

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sum of combinations

Dave O:

...and here is the code that generates them:
Sub Combinations()
Dim PA As Byte
Dim PB As Byte
Dim PD As Byte

For PA = 1 To 4
For PB = 1 To 3
For PD = 1 To 2
ActiveCell.Value = "PA" & PA & " + PB" & PB & "+ PC1 + PD" & PD
ActiveCell.Offset(1, 0).Select
Next PD
Next PB
Next PA

End Sub


Excellent!!
How could I generalize it?

Example:

In column B I have the names of the products, I don't know a priori how
many products are present in column B (between 2 and 100).
In cells to the right of the name of the product I have the values
(prices), I don't know a priori how many prices each product can assume
(between 1 and 6).
For example,
in cell B2 product1, in cell C2 90, in cell D2 100, in cell E2 150
in cell B3 product2, in cell C3 800, in cell D3 700
in cell B4 product3, in cell C4 5, in cell D4 8, in cell E4 3, in cell
F4 15
in cell B5 product4, in cell C5 130
....
In cells of column A I want to get all possible revenues of sales of
the products. Is it possibile?

Thanks
p.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK
 
Posts: n/a
Default Sum of combinations

Surely, if these are prices, then revenues will depend on how many of
each product are sold - where is this information? Do you envisage
another range of up to 6 columns which would contain projected number
of sales? And does that mean you want the minimum and the maximum of
price times number, i.e. two columns showing the range of revenues for
each product?

Do you know how many possible combinations you could get from 100
products, each of which could have up to 6 values?

Pete

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i find all possible combinations nomi Excel Discussion (Misc queries) 3 February 13th 06 12:33 PM
Possible Combinations Please HELP!!! Excel Discussion (Misc queries) 1 January 6th 06 03:58 PM
Tennis set combinations Raigmore Excel Discussion (Misc queries) 15 January 4th 06 02:10 PM
find all combinations of cells that add up to certain number AD Excel Worksheet Functions 1 November 17th 05 07:50 PM
triadic combinations of words jayock02 Excel Worksheet Functions 1 June 19th 05 02:10 AM


All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"