let
Source = Excel.CurrentWorkbook(){[Name="Base"]}[Content],
ColName = Table.ColumnNames(Source),
#"Grouped Rows" = Table.Group(Source, {"SITE"}, {{"AllData", each Table.AddIndexColumn(_,"Index",0)}}),
#"Added Custom" = Table.Combine(Table.AddColumn(#"Grouped Rows", "Custom", each let
alldata = [AllData],
Next = Table.AddColumn(alldata, "Next", each try Table.Column(alldata, ColName{5}){[Index] + 1} otherwise Table.Column(alldata, ColName{5}){[Index]}),
Result = Table.AddColumn(Next, "List", each {Table.Column(Next, ColName{5}){[Index]}..Table.Column(Next, "Next"){[Index]}-1} )
in Result)[Custom]),
Result = let fct = (fnRec as record) as list => List.Transform({ColName{5}}, each {_, each if List.Count(fnRec[List]) > 0 then fnRec[List] else {_} }) in Table.ExpandListColumn(Table.SelectColumns(Table.FromRecords(Table.TransformRows(#"Added Custom", (Rec) => Record.TransformFields(Rec, fct(Rec)))), ColName), ColName{5})
in
Result