Home > Mobile >  How to sort data into a table from columns with duplicate names with different information for each
How to sort data into a table from columns with duplicate names with different information for each

Time:11-17

So I have this data:

Name                   Post  ID
CASTILLO, FIONA         SN   32
ALDERETE, ROSABEL       AN   56
ALDERETE, ROSABEL       GN   11
ALMONARES, OLIVER       SN   3
ALMONARES, OLIVER       GN   2
ALVAREZ, JR., EDUARDO   GN   36
ALVAREZ, JR., EDUARDO   AN   1
ARELLANO, DONNALYN      SN   36
ARELLANO, DONNALYN      AN   63
ARELLANO, DONNALYN      GN   7
CASTILLO, FIONA         SN   1
CASTILLO, FIONA         SN   1
DE LEON, AMABEL         GN   1
DENNISON, GRETCHEN      AN   11
DENNISON, GRETCHEN      AN   26
DENNISON, GRETCHEN      SN   5

And I want to create a table where the rows are the unique names of the people (not duplicated) and the column headings are Name, SN, AN, GN, and the values inside are the corresponding numbers. I know how to create this using a pivot table But which function would separate the data once the table is created.

The data above are cells A2:C16 and my desired output is C2:C9 would be the names, C1 is the name header, D1 is the SN header, E1 is the AN header, and F1 is the GN header. The values occupying the table would be the ID that corresponds with each person.

CodePudding user response:

try:

=QUERY({A1:C}; "select Col1,max(Col3) where Col1 is not null group by Col1 pivot Col2")

you can change max for min, sum, avg or count if you need so

enter image description here

  • Related