Link to home
Start Free TrialLog in
Avatar of pwflexner
pwflexner

asked on

formula to produce all combinations of values in a column

In column A I have values from row 1 to row 60.  I need a formula to generate all of the combinations of the values in column A, which can be written in cell B1 and then copies down column B.

Example:

A1 = 1
A2 = 2
A3 = 3
A4 = 4

So,

B1 = A1+A1 = 2
B2 = A1+A2 = 3
B3 = A1+A3 = 4
B4 = A1+A4 = 5
B5 = A2+A2 = 4
B6 = A2+A3 = 5
B7 = A2+A4 = 6
B8 = A3+A3 = 6
B9 = A3+A4 = 7
B10 = A4+A4 = 8

I need a formula I can enter in cell B1 and copy down the column until all combinations have been computed.

Thanks.
Avatar of pwflexner
pwflexner

ASKER

I'm not sure how tough this question is, and thus how many points to assign it...
Avatar of Sharath S
What about the formula from B11 onwards?do you want to repeat the same pattern?
Hello,

this would be much easier with a matrix instead of a formula in a column.

With values in A1 to A60, copy these values to another sheet, starting with the first value in A2, not A1. Paste the same clipboard content of the 60 cells into cells B1 to BI1 with the Paste Special > Transpose option.

Then you can use a formula like this in cell B2

=$A2+B$1

copy down and across. You will have a matrix with 3600 cells.

cheers, teylyn
ASKER CERTIFIED SOLUTION
Avatar of JP
JP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to all, but peetjh's solution worked best for me.  Very elegant!!