Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how can i find all possible combinations | Excel Discussion (Misc queries) | |||
Possible Combinations | Excel Discussion (Misc queries) | |||
Tennis set combinations | Excel Discussion (Misc queries) | |||
find all combinations of cells that add up to certain number | Excel Worksheet Functions | |||
triadic combinations of words | Excel Worksheet Functions |