根据excel中另一列的值从列中的值创建对?

时间:2018-01-21 00:51:57

标签: excel

所以我需要创建两个列,其中包含excel中每个不同Z的每个可能的X对(包括具有单个X值的X)。

有什么方法可以实现这一点(就像我的截图中一样)?请记住,我的数据集有1000行。

How can I go create pairs for every Z that has many different X values?

非常感谢! :)

1 个答案:

答案 0 :(得分:0)

两个列表中所有可能组合的列表称为Cartesian Product,但我认为这并不完全符合您的需求,因为您需要{{1}的所有permutations值} X中的每个标签。

谷歌搜索"列出Excel中的所有组合"将显示一些让您关闭的示例,例如:

这些方法中的每一种都会找到所有组合,这是您想要为Z中的每个唯一值执行的操作。

您可以使用您选择的语言创建简单的代码:

Z

至于create an array that will later hold values from [X] for each row with data: make [currentLabel] = value from [Z] append value [X] to the array if [currentLabel] does not equal [previousLabel] then: {list all combinations in the array} (that will be the list for label [currentLabel]) clear the array make [previousLabel] = [currentLabel] next row ,这是最简单的部分:

{list all combinations in the array}[n] in the number of items in the array

[n] > 1
相关问题