Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default how can i get a list of combinations?

I would like to use excel to come up with a list of all combinations of 3,
from a list of 5 items. so for the 5 items, I am looking for all possible
combinations of 3. any ideas of how excel could help me with this so I don't
have to figure it out?

Thanks and Merry Christmas.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default how can i get a list of combinations?

On Dec 26, 7:21*am, Pastor Pudge <Pastor
wrote:
I would like to use excel to come up with a list of all combinations of 3,
from a list of 5 items. *so for the 5 items, I am looking for all possible
combinations of 3. *any ideas of how excel could help me with this so I don't
have to figure it out?

Thanks and Merry Christmas.


Hi,

This will wotk for any number of elements. It takes imput from column
A on sheet 1 and outputs to sheet 2.

Sub ComBinAtions()
Dim MyRange As Range
Dim OutPutSheet As Worksheet
Dim a As Long, b As Long, c As Long
Dim Elements As Long
lastrow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheet1.Range("A1:A" & lastrow)
Set OutPutSheet = Sheet2
Elements = MyRange.Cells.Count
For a = 1 To Elements - 2
For b = a + 1 To Elements - 1
For c = b + 1 To Elements
OutPutSheet.Cells(Rows.Count, 1).End(xlUp)(2, 1).Value = _
MyRange(a) & ", " & MyRange(b) & ", " & MyRange(c)
Next c
Next b
Next a
End Sub

Mike
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 to create a complete list of combinations from 5 options Nevermore Excel Discussion (Misc queries) 6 July 5th 09 04:04 PM
a list of all macros and their key combinations? z.entropic Excel Worksheet Functions 3 October 11th 07 05:03 PM
Can excel list combinations BOJO Excel Worksheet Functions 1 July 26th 07 12:26 AM
List combinations of a range Steve-in-austin Excel Discussion (Misc queries) 6 May 19th 06 07:37 PM
Need combinations of values from a list to add up to a specific Va GUY Excel Worksheet Functions 0 August 11th 05 11:40 AM


All times are GMT +1. The time now is 12:08 PM.

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"