简体   繁体   中英

Merging rows for duplicates in excel

I have an excel sheet with 300 duplicates. I need the first table to look like second table.

示例表

I don't know how to use vba.

I thought grouping by names in sql could help. I need guidance on how I could do this in excel.

I've tried with a pivot table but it doesn't exactly give me what I want.

Suggestions on how to achieve this would be great.

This is quick and easy using ( Get & Transform Data ).

Make sure your source data is formatted as a table , and give the first column the header "Name". Then you can use a query like:

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Attribute]), "Attribute", "Value", List.Sum)
in
    #"Pivoted Column"

EDIT Here's aa worked example, using your data: https://excel.solutions/53186328/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM