|
- let
- 源 = Excel.CurrentWorkbook(){[Name = "表2"]}[Content],
- a = Table.ToRows(源),
- b = List.Accumulate(
- a,
- [result = {}, before = "", n = 0, du = {}],
- (s, c) =>
- if c{0} <> null then
- [result = s[result], before = c{0}, n = s[n], du = s[du] & {s[n]}]
- else if s[before] <> null then
- [result = s[result] & {c{1}}, before = c{0}, n = s[n] + 1, du = s[du]]
- else
- s
- ),
- c = List.Transform(b[du], each b[result]{_}),
- d = Table.ToColumns(Table.SelectRows(源, each ([Account] <> null))) & {c},
- return = Table.FromColumns(d, Table.ColumnNames(源) & {"Blank"})
- in
- return
复制代码
|
|