Generate all possible combinations

Gogol D

New Member
Joined
May 5, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Dear All Friends,

This is my 1st post here and below is my problem statement.

I have data in two columns. Column A1 - A6 contains : AA, BB, CC, DD, EE, FF. And column B1-B3 contains +1, -1, 0

In column C and D, I want to create the following -

1st scenario:

Col C Col D

AA +1

BB +1

CC +1

DD +1

EE +1

FF +1

2nd scenario:

Col C Col D

AA -1

BB +1

CC +1

DD +1

EE +1

FF +1

3rd scenario:

Col C Col D

AA 0

BB +1

CC +1

DD +1

EE +1

FF +1

4th scenario:

Col C Col D

AA +1

BB -1

CC +1

DD +1

EE +1

FF +1

5th scenario:

Col C Col D

AA +1

BB -0

CC +1

DD +1

EE +1

FF +1

so on and so forth

So essentially, I want to populate all possible combinations where AA - FF remains constant while +1,-1 and 0 changes for those 6 elements (AA - FF) in different combinations.

Hope my query is clear. Looking forward to your help.

Regards,

D
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Not exactly what you asked for but generates all of the combos.

temporary.xlsm
ABC
2AA+1AA-+1
3BB-1AA--1
4CC0AA-0
5DDBB-+1
6EEBB--1
7FFBB-0
8CC-+1
9CC--1
10CC-0
11DD-+1
12DD--1
13DD-0
14EE-+1
15EE--1
16EE-0
17FF-+1
18FF--1
19FF-0
Sheet10
Cell Formulas
RangeFormula
C2:C19C2=IF(ROW()-ROW($D$2)+1>COUNTA($A$2:$A$7)*COUNTA($B$2:$B$4),"",INDEX($A$2:$A$7,INT((ROW()-ROW($D$2))/COUNTA($B$2:$B$4)+1))&"-"&INDEX($B$2:$B$4,MOD(ROW()-ROW($D$2),COUNTA($B$2:$B$4))+1))
 
Upvote 0
Another version (but still not exactly what you asked for) that maybe you can play with this:

Code:
=A2:A7&" "&INDEX(B2:B4,1+MOD(SEQUENCE(6,3)-1,3))

OR

Code:
=INDEX(A2:A7&" "&INDEX(B2:B4,1+MOD(SEQUENCE(6,3)-1,3)),ROUNDUP(SEQUENCE(18)/3,0),MOD(SEQUENCE(18,,0),3)+1)
 
Last edited:
Upvote 0
Thanks for sharing this Kweaver.

As you have rightfully mentioned, this doesn't give what exactly I am looking for. If you see, all of these formulae are just populating 6X3 = 18 combinations / scenarios. However, if you observe, the number of possible scenarios seem to be even pretty higher. What I mean by is that, now there will be possible permutation and combinations within these 18 observations as well and I need to populate the same.

Any further leads?

Best
G
 
Upvote 0
You'll have to show me what other results you are expecting. With 6 and 3 there are only 18 as you pointed out.
 
Upvote 0
You'll have to show me what other results you are expecting. With 6 and 3 there are only 18 as you pointed out.
Sure. I mean to say the following -

NBRX being +1, -1, or 0, there could be 10 scenarios while varying values for others. Likewise, many such scenario could be plotted. I just want to create those individual unique scenarios for further analysis. So I was thinking may be 5^3 such possibilities could be there. Please let me know your thoughts.

Scenario n1NBRx +1
TRx-1
MS%-1
Rejection-1
Reversal-1
purchase-1
Scenario n2NBRx +1
TRx0
MS%0
Rejection0
Reversal0
purchase0
Scenario n3NBRx +1
TRx+1
MS%+1
Rejection+1
Reversal+1
purchase+1
Scenario n4NBRx0
TRx0
MS%0
Rejection0
Reversal0
purchase0
Scenario n5NBRx 0
TRx-1
MS%-1
Rejection-1
Reversal-1
purchase-1
Scenario n6NBRx 0
TRx+1
MS%+1
Rejection+1
Reversal+1
purchase+1
Scenario n7NBRx -1
TRx-1
MS%-1
Rejection-1
Reversal-1
purchase-1
Scenario n8NBRx -1
TRx+1
MS%+1
Rejection+1
Reversal+1
purchase+1
Scenario n9NBRx -1
TRx0
MS%0
Rejection0
Reversal0
purchase0
 
Upvote 0
Sorry
Sure. I mean to say the following -

NBRX being +1, -1, or 0, there could be 10 scenarios while varying values for others. Likewise, many such scenario could be plotted. I just want to create those individual unique scenarios for further analysis. So I was thinking may be 5^3 such possibilities could be there. Please let me know your thoughts.

Scenario n1NBRx +1
TRx-1
MS%-1
Rejection-1
Reversal-1
purchase-1
Scenario n2NBRx +1
TRx0
MS%0
Rejection0
Reversal0
purchase0
Scenario n3NBRx +1
TRx+1
MS%+1
Rejection+1
Reversal+1
purchase+1
Scenario n4NBRx0
TRx0
MS%0
Rejection0
Reversal0
purchase0
Scenario n5NBRx 0
TRx-1
MS%-1
Rejection-1
Reversal-1
purchase-1
Scenario n6NBRx 0
TRx+1
MS%+1
Rejection+1
Reversal+1
purchase+1
Scenario n7NBRx -1
TRx-1
MS%-1
Rejection-1
Reversal-1
purchase-1
Scenario n8NBRx -1
TRx+1
MS%+1
Rejection+1
Reversal+1
purchase+1
Scenario n9NBRx -1
TRx0
MS%0
Rejection0
Reversal0
purchase0
Sorry, I mean 6^3 such possibilities.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: https://www.myonlinetraininghub.com/excel-forum/excel/generate-all-possible-combinations
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,445
Messages
6,172,176
Members
452,446
Latest member
walkman99

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