提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中列出或生成所有可能的组合?

doc列出所有组合01

假设我有以下两列数据,现在,我想基于两个值列表生成所有可能组合的列表,如左侧屏幕截图所示。 也许,如果值很少,你可以逐个列出所有组合,但是,如果有多个列需要列出多个值可能的组合,这里有一些快速的技巧可以帮助你在Excel中处理这个问题。

列出或生成所有可能的公式组合

使用Kutools for Excel列出或生成所有可能的组合


列出或生成多列的所有可能组合

如果您需要基于多列数据生成所有可能的组合,可能,没有一种好的方法来处理任务。 但, Kutools for Excel's 列出所有组合 实用程序可以帮助您快速轻松地列出所有可能的组合。 点击下载Kutools for Excel!

doc列出所有组合

Kutools for Excel:比300方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


列出/生成所有可能的公式组合


以下长公式可以帮助您快速列出两个列表值的所有可能组合,请按照以下步骤操作:

1。 输入这个公式: =IF(ROW()-ROW($D$1)+1>COUNTA($A$1:$A$4)*COUNTA($B$1:$B$3),"",INDEX($A$1:$A$4,INT((ROW()-ROW($D$1))/COUNTA($B$1:$B$3)+1))&INDEX($B$1:$B$3,MOD(ROW()-ROW($D$1),COUNTA($B$1:$B$3))+1)) 进入一个空白单元格,在这种情况下,我将它输入到单元格D1,然后按 输入 键取得结果,看截图:

doc列出所有组合2

注意:在上面的公式中, $ A $ 1:$ A $ 4,是第一列值,和 $ B $ 1:$ B $ 3 是要列出所有可能组合的第二个列表值 $ d $ 1 是放置公式的单元格,可以根据需要更改单元格引用。

2。 然后选择单元格D1并将填充手柄向下拖动到单元格直到获得空白单元格,并且基于这两个列表值列出了所有可能的组合。 看截图:

doc列出所有组合3


列出/生成Kutools for Excel的所有可能组合

上述公式可以帮助您生成只有两个列表的可能组合,如果有多于两个列表值需要列出可能的组合,公式将不起作用。 在这里,我可以推荐一个强大的工具 - Kutools for Excel它包含一个方便的功能 列出所有组合 它可以根据给定的数据列表快速列出所有可能的组合。

Kutools for Excel : 与超过300方便的Excel加载项,在60天免费试用没有限制.

安装后 Kutools for Excel请按照以下步骤进行:

1. 点击 Kutools > 插页 > 列出所有组合,看截图:

doc列出所有组合4

2。 在 列出所有组合 对话框,请执行以下操作:

(1。)选择 价值 来自 类型 下拉列表;

(2。)然后点击 doc列表组合6 按钮选择您想要使用的第一个数据列表(您也可以输入用逗号分隔的值 文本 一盒一盒)

doc列出所有组合5

3。 然后点击 添加 按钮将第一个值列表添加到 组合列表 框中,看截图:

doc列出所有组合6

4。 如果您需要使用特定字符分隔组合,请选择 分隔器 来自 类型 下拉菜单,然后在文本框中指定您需要的分隔符,然后单击 添加 按钮将分隔符添加到 组合列表,看截图:

doc列出所有组合7

5。 然后重复step3和step4将其他数据列表和分隔符插入到 组合列表 框中,看截图:

doc列出所有组合8

6。 插入数据列表后,单击 Ok 按钮,弹出提示框提醒您选择一个单元输出结果,查看截图:

doc列出所有组合9

7。 点击 OK,所有基于给定列表的可能组合都已经生成到工作表中,如下面的截图所示:

doc列出所有组合10

注意:如果您不需要组合之间的分隔符,则只需跳过步骤4并将值列表添加到对话框中即可。

点击下载Kutools for Excel Now!


列出/生成Kutools for Excel的所有可能组合

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Guy · 7 days ago
    Is there a way to output this as a txt file? When you have millions of results in the D column it's not exactly practical to drag the fill handle.
  • To post as a guest, your comment is unpublished.
    JJ · 6 months ago
    Almost very handy. Would be good if it actually used whatever is in the cell ($A$1)and not convert the cell to text. Then I could just paste what I need in A1 and run it again without having to change anything.
  • To post as a guest, your comment is unpublished.
    Sergio Gomez · 11 months ago
    I used the extions and works fantastic,, but now i have a problem, i need to calculate the sum,, but the result is a text,, i enter a separator that is the simbol +, but finally i have a text and is impossible to convert in a operation.
  • To post as a guest, your comment is unpublished.
    sergio · 11 months ago
    Hello, and if these combinations intead text are number,, how can i made the calculation for the results???? i try to add the "+" but excel dont know that is the simbol.. how you solve this?
  • To post as a guest, your comment is unpublished.
    ricardo · 11 months ago
    Hola me arroja una referencia circula la formula
    =SI(FILA()-FILA($D$1)+1>(CONTARA($A$1:$A$4)*CONTARA($B$1:$B$3));"";INDICE($A$1:$A$4;RESIDUO((FILA()-FILA($D$1));COUNTA($B$1:$B$3)+1))
    &INDICE($B$1:$B$3;RESIDUO(FILA()-FILA($D$1);CONTARA($B$1:$B$3))+1))
  • To post as a guest, your comment is unpublished.
    Anirban Karmakar · 1 years ago
    Why my formula did not work to create 25 combinations in Column E (5 elements from Col A * 5 elements from Col B) ? Whereas the formula in this article worked in Column D when I dragged it for 25 cells? Screenshot - https://prnt.sc/ihwr18
  • To post as a guest, your comment is unpublished.
    Mihai · 1 years ago
    Hi,
    I want to know what to do if I want to generate more than 1,4 million combination and I exceede the Excel rows limit?
    Is there a way of puting Kudos to continue its iteration on the next column?
  • To post as a guest, your comment is unpublished.
    Marco · 1 years ago
    Has anyone figured out a formula yet to do this for 5 sets of data? I've been stumped on this so far.
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello, Marco,
      The Kutools can help you to solve your problem quickly,please check the following screenshot:
      Please try it, hope it can help you, thank you!
  • To post as a guest, your comment is unpublished.
    Arthur · 1 years ago
    Is KuTools able to sort cells in a row in a "simple combination" fashion?
    I mean, if I have these data:
    _________________________
    John Jack Paul Macy

    Mark Larry

    Jerry Paul Mary

    Sam Jeff Peter Lucas
    _________________________



    And I want to output them like this:
    ___________
    John Jack

    John Paul

    John Macy

    Jack Paul

    Jack Macy

    Paul Macy

    Mark Larry

    Jerry Paul

    Jerry Marry

    Paul Mary

    Sam Jeff

    Sam Peter

    Sam Lucas

    Jeff Peter

    Jeff Lucas

    Peter Lucas
    ____________


    How can I do this? Can KuTools do sth like this?

    Thanks!
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hi, Arthur,
      Sorry, the Kutools can not help you to solve this job as you said.
      Thank your for your comment.
  • To post as a guest, your comment is unpublished.
    Eoin · 1 years ago
    Any idea how to add a space inbetween ?
    • To post as a guest, your comment is unpublished.
      Mary · 1 years ago
      You can add a space by adding " "& before you index column B, right after the existing &, like so.....

      =IF(ROW()-ROW($D$1)+1>COUNTA($A$1:$A$4)*COUNTA($B$1:$B$3),"",INDEX($A$1:$A$4,INT((ROW()-ROW($D$1))/COUNTA($B$1:$B$3)+1))&" "&INDEX($B$1:$B$3,MOD(ROW()-ROW($D$1),COUNTA($B$1:$B$3))+1))


      ....or any other delimiter you like!
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello, Eoin,
      the formula in this article can not help you to add a space between the cell values, but, you can apply the Kutools for Excel, with it, you can type any delimiter as you want to separate the combined result, see screenshot:
  • To post as a guest, your comment is unpublished.
    DeleteThisPost · 2 years ago
    For more columns:
    The first part of the formulate needs to be modified to multiply all the possibilities, for example this would be for 6 columns:

    COUNTA($A$2:$A$9)*COUNTA($B$2:$B$9)*COUNTA($C$2:$C$9)*COUNTA($D$2:$D$9)*COUNTA($E$2:$E$9)*COUNTA($F$2:$F$9)
    so you are adding
    *COUNTA(YourRangeHere)
    for each column

    The second part of the formula needs to be modified for each column as well like so:

    INDEX($A$2:$A$9,MOD(ROW()-ROW($I$2),COUNTA($A$2:$A$9))+1)&INDEX($B$2:$B$9,MOD(ROW()-ROW($I$2),COUNTA($B$2:$B$9))+1)&INDEX($C$2:$C$9,MOD(ROW()-ROW($I$2),COUNTA($C$2:$C$9))+1)&INDEX($D$2:$D$9,MOD(ROW()-ROW($I$2),COUNTA($D$2:$D$9))+1)&INDEX($E$2:$E$9,MOD(ROW()-ROW($I$2),COUNTA($E$2:$E$9))+1)&INDEX($F$2:$F$9,MOD(ROW()-ROW($I$2),COUNTA($F$2:$F$9))+1)

    so you are adding

    &INDEX(YourRangeHere,MOD(ROW()-ROW($I$2),COUNTA(YourRangeHere))+1)

    So put them all together and you get this example for 6 columns:

    =IF(ROW()-ROW($I$2)+1>COUNTA($A$2:$A$9)*COUNTA($B$2:$B$9)*COUNTA($C$2:$C$9)*COUNTA($D$2:$D$9)*COUNTA($E$2:$E$9)*COUNTA($F$2:$F$9),"",INDEX($A$2:$A$9,MOD(ROW()-ROW($I$2),COUNTA($A$2:$A$9))+1)&INDEX($B$2:$B$9,MOD(ROW()-ROW($I$2),COUNTA($B$2:$B$9))+1)&INDEX($C$2:$C$9,MOD(ROW()-ROW($I$2),COUNTA($C$2:$C$9))+1)&INDEX($D$2:$D$9,MOD(ROW()-ROW($I$2),COUNTA($D$2:$D$9))+1)&INDEX($E$2:$E$9,MOD(ROW()-ROW($I$2),COUNTA($E$2:$E$9))+1)&INDEX($F$2:$F$9,MOD(ROW()-ROW($I$2),COUNTA($F$2:$F$9))+1))

    Where you would paste this formula into $I$2 and it would be looking at $A$2:$A$9 $B$2:$B$9 $C$2:$C$9 ... up to $F$2:$F$9
  • To post as a guest, your comment is unpublished.
    JiffyLimbo · 2 years ago
    For more columns:
    The first part of the formulate needs to be modified to multiply all the possibilities, for example this would be for 6 columns
    COUNTA($A$2:$A$9)*COUNTA($B$2:$B$9)*COUNTA($C$2:$C$9)*COUNTA($D$2:$D$9)*COUNTA($E$2:$E$9)*COUNTA($F$2:$F$9)
    so you are adding
    *COUNTA(YourRangeHere)
    for each column
    The second part of the formula needs to be modified for each column as well like so:
    INDEX($A$2:$A$9,MOD(ROW()-ROW($I$2),COUNTA($A$2:$A$9))+1)&INDEX($B$2:$B$9,MOD(ROW()-ROW($I$2),COUNTA($B$2:$B$9))+1)&INDEX($C$2:$C$9,MOD(ROW()-ROW($I$2),COUNTA($C$2:$C$9))+1)&INDEX($D$2:$D$9,MOD(ROW()-ROW($I$2),COUNTA($D$2:$D$9))+1)&INDEX($E$2:$E$9,MOD(ROW()-ROW($I$2),COUNTA($E$2:$E$9))+1)&INDEX($F$2:$F$9,MOD(ROW()-ROW($I$2),COUNTA($F$2:$F$9))+1)
    so you are adding
    &INDEX(YourRangeHere,MOD(ROW()-ROW($I$2),COUNTA(YourRangeHere))+1)

    So put them all together and you get this example for 6 columns:

    =IF(ROW()-ROW($I$2)+1>COUNTA($A$2:$A$9)*COUNTA($B$2:$B$9)*COUNTA($C$2:$C$9)*COUNTA($D$2:$D$9)*COUNTA($E$2:$E$9)*COUNTA($F$2:$F$9),"",INDEX($A$2:$A$9,MOD(ROW()-ROW($I$2),COUNTA($A$2:$A$9))+1)&INDEX($B$2:$B$9,MOD(ROW()-ROW($I$2),COUNTA($B$2:$B$9))+1)&INDEX($C$2:$C$9,MOD(ROW()-ROW($I$2),COUNTA($C$2:$C$9))+1)&INDEX($D$2:$D$9,MOD(ROW()-ROW($I$2),COUNTA($D$2:$D$9))+1)&INDEX($E$2:$E$9,MOD(ROW()-ROW($I$2),COUNTA($E$2:$E$9))+1)&INDEX($F$2:$F$9,MOD(ROW()-ROW($I$2),COUNTA($F$2:$F$9))+1))

    Where you would paste this formula into $I$2 and it would be looking at $A$2:$A$9 $B$2:$B$9 $C$2:$C$9 ... up to $F$2:$F$9
  • To post as a guest, your comment is unpublished.
    Javier · 2 years ago
    anyone know how to modify this to reflect 6 columns of data?
  • To post as a guest, your comment is unpublished.
    Javier · 2 years ago
    anyone know how to modify this to reflect 6 columns of data, rather than just two?
    • To post as a guest, your comment is unpublished.
      shey · 2 years ago
      looking for the same thing. anyone know?
  • To post as a guest, your comment is unpublished.
    NB · 2 years ago
    How could you use KuTools, or even a formula, if you wanted all the permutations of the Month header. Jan, Jan and Feb, Jan and Mar, Jan and Mar, Jan and Feb and Mar, etc etc
  • To post as a guest, your comment is unpublished.
    jitu · 2 years ago
    VERY HELPFUL.I am now able to generate combinations very easily.
  • To post as a guest, your comment is unpublished.
    Veerendra Kumar · 3 years ago
    Can I get the formula for all the combinations of a 5*5 matrix (5 rows and 5 columns ) I tried but not able to get please help me.......
  • To post as a guest, your comment is unpublished.
    Free · 3 years ago
    Is there a way to make this formula work where it produces the various combinations still separated in 2 separate columns, but adjacent to one another?
    • To post as a guest, your comment is unpublished.
      Bill · 2 years ago
      Have you had any luck with this yet? I'm trying to do the same thing and have all of the possible combinations next to each other in a 2 separate columns.
    • To post as a guest, your comment is unpublished.
      Bill · 2 years ago
      Have you had any luck figuring out how to do this? I'm trying to do the exact same thing and have all of my probabilities in 2 separate columns in excel.
  • To post as a guest, your comment is unpublished.
    GATES · 3 years ago
    example : my list of values is 1,2,3,4,5,6......80 , i want kutool to display all combinations of a set of 2 numbers, example : 1-2 , 1-3 , 1-4 , 1-5 , ..................79-80 . is this possible with KUTOOL ?
  • To post as a guest, your comment is unpublished.
    Kyle · 3 years ago
    This is a brilliant formula! I have no clue how it works, but I just change the collum A and B to match how long my lists are, and have my output in D1.