我有一列包含字母和数字,我试图将其扩展到新行。 我还希望将该范围编号内的整行复制到新行中。可以用excel做吗?
原表:
A 栏 | B 栏 |
---|---|
A123-A125 | 苹果 |
B23-B24 | 香蕉 |
新表:
A 栏 | B 栏 |
---|---|
A123 | 苹果 |
A124 | 苹果 |
A125 | 苹果 |
B23 | 香蕉 |
B24 | 香蕉 |
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
AddCustomColumn = Table.AddColumn(Source, "ExpandedRange", each let
RangeStart = Text.Middle([Column A], 1, Text.PositionOf([Column A], "-") - 1),
RangeEnd = Text.Middle([Column A], Text.PositionOf([Column A], "-") + 1),
StartNumber = Number.From(Text.Remove(RangeStart, {"A".."Z"})),
EndNumber = Number.From(Text.Remove(RangeEnd, {"A".."Z"})),
Prefix = Text.Remove(RangeStart, {"0".."9"}),
RangeList = List.Transform({StartNumber..EndNumber}, each Prefix & Text.From(_))
in
RangeList),
ExpandColumn = Table.ExpandListColumn(AddCustomColumn, "ExpandedRange"),
RemoveOriginalColumn = Table.RemoveColumns(ExpandColumn, {"Column A"}),
RenameColumns = Table.RenameColumns(RemoveOriginalColumn, {{"ExpandedRange", "Column A"}})
in
RenameColumns