I"ve a data table (1) below and want the result as in table (2). How can I do this?

I"ve a data table (1) below and want the result as in table (2). How can I do this?

 
    
     
    
    I'd suggest the following:
State column using Split Column > By Delimiter. 
    
    You could use this code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    group = Table.Group(Source, {"Name"}, {{"State", each Text.Combine(List.Distinct([State]), "|")}}),
    split = Table.SplitColumn(group, "State", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), {"State.1", "State.2", "State.3"})
in
    split
 
    
    Have a look a this topic: VBA excel, concatenate cells when there are duplicates .
You could use that vlookupall function and then use "Text to column" on your result.
