Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd appreciate your help with creating this table.
I have the following data in the following cells (for example - the real table is much longer): A1 USD A2 EUR A3 GBP A4 JPY A5 CHF I'd like to create a list of all possible combination of 2 cells combined, e.g., USDEUR, USDGBP, USDJPY, USDCHF, EURGBP, EURJPY, EURCHF, GBPJPY, GBPCHF and JPYCHF. The new created table should avoid repetition of a combination that was already created (USDEUR and EURUSD for example). And the new table should be in a single column if possible. Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about:
Sub Combine() Dim I As Long, J As Long, N As Long, K As Long N = Cells(Rows.Count, "A").End(xlUp).Row K = 1 For I = 1 To N v1 = Cells(I, 1) For J = I + 1 To N Cells(K, 2).Value = v1 & Cells(J, 1).Value K = K + 1 Next Next End Sub This will produce: USDEUR USDGBP USDJPY USDCHF EURGBP EURJPY EURCHF GBPJPY GBPCHF JPYCHF |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
James Ravenswood wrote:
How about: Sub Combine() Dim I As Long, J As Long, N As Long, K As Long N = Cells(Rows.Count, "A").End(xlUp).Row K = 1 For I = 1 To N This line needs to be changed to this: For I = 1 To N - 1 v1 = Cells(I, 1) For J = I + 1 To N Cells(K, 2).Value = v1 & Cells(J, 1).Value K = K + 1 Next Next End Sub This will produce: USDEUR USDGBP USDJPY USDCHF EURGBP EURJPY EURCHF GBPJPY GBPCHF JPYCHF -- You have been killed by a stick of butter. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
create new table from Multiple Criteria in multiple columns | Excel Worksheet Functions | |||
how do i create table of contents links/pg for multiple workbooks | Excel Worksheet Functions | |||
How do I create a combination chart and table with different data. | Charts and Charting in Excel | |||
Pivot Table--How can I create from multiple sheets? | New Users to Excel | |||
how do I create a pivot table based on multiple sheets | Excel Discussion (Misc queries) |