|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我的城市你来过 发表于 2024-7-22 10:34
20240722分列汇总转一维
=REDUCE($A$1:$C$1,$B$2:$B$4,LAMBDA(x,y,VSTACK(x,CHOOSE({1,2,3},OFFSET(y,,-1) ... - Sub rr()
- Set a = Worksheets(1)
- x = a.UsedRange.Rows.Count
- k = 11
- For ii = 2 To x
- str_0 = a.Cells(ii, 2)
- str_1 = a.Cells(ii, 3)
- str_1 = Replace(Replace(str_1, "【", ""), "】", "")
- arr = Split(str_0, "+")
- aarr = Split(str_1, "+")
- nn = UBound(arr)
- For i = 0 To nn
- If InStr(arr(i), "") > 0 Then
- brr = Split(arr(i), "")
- bbrr = Split(aarr(i), "")
- For j = 0 To UBound(brr)
- a.Cells(k, 1) = a.Cells(ii, 1)
- a.Cells(k, 2) = brr(j)
- a.Cells(k, 3) = bbrr(j)
- k = k + 1
- Next
- Else
- a.Cells(k, 1) = a.Cells(ii, 1)
-
- a.Cells(k, 2) = arr(i)
- a.Cells(k, 3) = aarr(i)
- k = k + 1
- End If
- Next
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|