是否有一种方法可以基于单元格值中的多个条目在excel中常规复制行

问题描述 投票:0回答:1

这是我当前的格式

enter image description here

我想要一个公式,以便输出像这样

enter image description here

excel duplicates rows
1个回答
0
投票

[在列[[A和B中有数据,请尝试以下简短宏:

Sub SplitList() Dim i As Long, j As Long, N As Long Dim v As String, arr, a N = Cells(Rows.Count, "A").End(xlUp).Row j = 1 For i = 1 To N v = Cells(i, 1).Value arr = Split(Cells(i, 2).Value, ",") For Each a In arr Cells(j, 3).Value = v Cells(j, 4).Value = a j = j + 1 Next a Next i End Sub
enter image description here

输出以列

C

D为单位。
© www.soinside.com 2019 - 2025. All rights reserved.