• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

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.
0
pwflexner
Asked:
pwflexner
1 Solution
 
pwflexnerAuthor Commented:
I'm not sure how tough this question is, and thus how many points to assign it...
0
 
SharathData EngineerCommented:
What about the formula from B11 onwards?do you want to repeat the same pattern?
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
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
0
 
JPIT DirectorCommented:
Try the attached file, I created a macro that will build the formulas for you.
Create-Formulas.xlsm
0
 
pwflexnerAuthor Commented:
Thanks to all, but peetjh's solution worked best for me.  Very elegant!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now