Word combinations

power2nc

New Member
Joined
Nov 5, 2009
Messages
21
I am trying to create several uqunie paragraphs from several combinations.

Example
Line 1: Hi, hello, Greetings
Line 2: my name is mike, how are you doing, whats up
Line 3: !, ?, .
Hi, my name is mike!
Hi, how are you doing?
Hi, whats up!
hello, my name is mike!

Basically I want to create every combination possible. I will have 5 options and strings. (5x5x5x5x5=3125 different combinations)

I have done something like this before but cant remember how I got started. Any help will be appreciated. Thanks!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What 5 options, and what 5 strings?

How are your VBA skills?
 
Upvote 0
Have a look at this data, and output:

Excel Workbook
ABC
1HihelloGreetings
2my name is mikehow are you doingwhats up
3!?.
4
5Hi, my name is mike!
6Hi, my name is mike?
7Hi, my name is mike.
8Hi, how are you doing!
9Hi, how are you doing?
10Hi, how are you doing.
11Hi, whats up!
12Hi, whats up?
13Hi, whats up.
14hello, my name is mike!
15hello, my name is mike?
16hello, my name is mike.
17hello, how are you doing!
18hello, how are you doing?
19hello, how are you doing.
20hello, whats up!
21hello, whats up?
22hello, whats up.
23Greetings, my name is mike!
24Greetings, my name is mike?
25Greetings, my name is mike.
26Greetings, how are you doing!
27Greetings, how are you doing?
28Greetings, how are you doing.
29Greetings, whats up!
30Greetings, whats up?
31Greetings, whats up.
Sheet5


produced from this macro:
Code:
Sub wordcombo()
    irow = 5
        For i = 1 To 3
            For j = 1 To 3
                For k = 1 To 3
                    Cells(irow, 1).Value = Cells(1, i) & ", " & Cells(2, j) & Cells(3, k)
                    irow = irow + 1
                Next
            Next
        Next
            
End Sub

Does that help?
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top