Excel 多组项目的组合

Excel combinations of multiple sets of items

我正在寻找一种简单的方法来列出 excel 中三组项目的所有可能组合。

例如,取以下三组项目,每组项目在其自己的单元格中:

(meals) pizza, pasta, lasagne    
(drinks) wine, beer, water    
(dessert) ice, fruits

现在我想列出所有可能的组合,每个组合都在自己的行中,例如

pizza, wine, ice
pasta, wine, ice
lasagne, wine, ice
pizza, wine, fruits
...
lasagne, water, fruits

顺序无关紧要。

是否有任何预定义函数?

像这样将项目放在工作表的前三列中
A B C pizza wine ice pasta beer fruits lasagne water

然后,你可以用下面的公式得到F、G、H中的组合。

F1:
=IF(ROW()-ROW($F)+1<=COUNTA(A:A)*COUNTA(B:B)*COUNTA(C:C), INDEX(A:A,INT((ROW()-ROW($F))/(COUNTA(B:B)*COUNTA(C:C))+1)), "")

G1:
=IF(ROW()-ROW($F)+1<=COUNTA(A:A)*COUNTA(B:B)*COUNTA(C:C), INDEX(B:B,MOD(ROW()-ROW($F),COUNTA(B:B))+1), "")

H1:
=IF(ROW()-ROW($F)+1<=COUNTA(A:A)*COUNTA(B:B)*COUNTA(C:C), INDEX(C:C,MOD(ROW()-ROW($F),COUNTA(C:C))+1), "")

下拉单元格直到值为空。那么您可能希望将结果合并到第一列 =IF(F1<>"", F1 & ", " & G1& ", " & H1, "")