根据数量重复行

时间:2019-05-14 19:45:49

标签: google-sheets concatenation array-formulas google-sheets-formula

我有一个数据表,格式为:

+--------------+------+----------+
| Manufacturer | Item | Quantity |
+--------------+------+----------+

我需要重新安排它,以便每个项目都有自己的行,这样:

+--------------+------+----------+
| Manufacturer | Item | Quantity |
+--------------+------+----------+
| Coca Cola    | Coke |       4  |
+--------------+------+----------+

成为:

+--------------+------+
| Manufacturer | Item |
+--------------+------+
| Coca Cola    | Coke |
| Coca Cola    | Coke |
| Coca Cola    | Coke |
| Coca Cola    | Coke |
+--------------+------+

我已经编写了此代码,该代码适用于源表中的一行:

=split(transpose(split(rept(Join("|",A5:B5)&"$$", C5),"$$")),"|")

但是我不确定如何将其扩展到整个表。这样做:

=arrayformula(split(transpose(split(rept(Join("|",A5:B)&"$$", C5:C),"$$")),"|"))

..只是给出一个错误

  

JOIN范围必须是单行或单列。

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:1)

host0

0