Convert info to matrix

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Okay, I can do this with a PT, wondering how you would do it with formulae/PQ. Doing this for educational purposes only.
Book3
ABCDEFGHIJ
1NameSubjectScoreMathsChemEnglishGeogHistory
2JackMaths95Jack9562
3BertChem51Bert51
4JackEnglish62Steve 8545
5Steve Maths85Jenny87
6JennyMaths87Mary84
7MaryEnglish84Vic60
8Steve Geog45Jake100
9VicChem60
10JakeHistory100
Sheet1


Information comes in as above (A to C), I need it to be as in columns E to J.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Book1.xlsm
ABCDEFGHIJ
1NameSubjectScoreMathsChemEnglishGeogHistory
2JackMaths95Jack95 62  
3BertChem51Bert 51   
4JackEnglish62Steve85  45 
5SteveMaths85Jenny87    
6JennyMaths87Mary  84  
7MaryEnglish84Vic 60   
8SteveGeog45Jake    100
9VicChem60
10JakeHistory100
Sheet4
Cell Formulas
RangeFormula
F2:J8F2=IFERROR(INDEX($C$2:$C$10,MATCH(1,($A$2:$A$10=$E2)*($B$2:$B$10=F$1),0)),"")
 
Upvote 0
Just noticed you use Excel 365. Here's another way uisng the FILTER function.
Book1.xlsm
ABCDEFGHIJ
1NameSubjectScoreMathsChemEnglishGeogHistory
2JackMaths95Jack95 62  
3BertChem51Bert 51   
4JackEnglish62Steve85  45 
5SteveMaths85Jenny87    
6JennyMaths87Mary  84  
7MaryEnglish84Vic 60   
8SteveGeog45Jake    100
9VicChem60
10JakeHistory100
Sheet4 (2)
Cell Formulas
RangeFormula
F2:J8F2=FILTER($C$2:$C$10,($A$2:$A$10=$E2)*($B$2:$B$10=F$1),"")
 
Upvote 0
With Excel 365 you could use the FILTER function.
Drag formula in F2 down and across.

Book1
ABCDEFGHIJ
1NameSubjectScoreMathsChemEnglishGeogHistory
2JackMaths95Jack95 62  
3BertChem51Bert 51   
4JackEnglish62Steve 85  45 
5Steve Maths85Jenny87    
6JennyMaths87Mary  84  
7MaryEnglish84Vic 60   
8Steve Geog45Jake    100
9VicChem60
10JakeHistory100
Sheet1
Cell Formulas
RangeFormula
F2:J8F2=FILTER($C$2:$C$10,($A$2:$A$10=$E2)*($B$2:$B$10=F$1),"")
 
Upvote 0
With PQ, try
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    ReordC = Table.ReorderColumns(Source,{"Subject", "Name", "Score"}),
    PivotC = Table.Pivot(ReordC, List.Distinct(ReordC[Subject]), "Subject", "Score", List.Sum)
in
    PivotC
 
Upvote 0
Thanks everyone, great responses and nice succinct solutions.
 
Upvote 0
Filter Vertical / Horizontal Headers

Book1
ABCDEFGHIJ
1NameSubjectScoreMathsChemEnglishGeogHistory
2JackMaths95Jack95 62  
3BertChem51Bert 51   
4JackEnglish62Steve85  45 
5SteveMaths85Jenny87    
6JennyMaths87Mary  84  
7MaryEnglish84Vic 60   
8SteveGeog45Jake    100
9VicChem60     
10JakeHistory100     
11
Sheet1
Cell Formulas
RangeFormula
F1:J1F1=IFERROR(INDEX($B$2:$B$10,AGGREGATE(15,6,MATCH($B$2:$B$10,$B$2:$B$10,0)/(MATCH($B$2:$B$10,$B$2:$B$10,0)=(ROW($B$2:$B$10)-ROW($B$2)+1)),COLUMNS($F$1:F1))),"")
F2:J10F2=IFERROR(INDEX($C$2:$C$10,AGGREGATE(14,6,(ROW($A$2:$A$10)-ROW($A$2)+1)/($A$2:$A$10=$E2)/($B$2:$B$10=F$1),1)),"")
E2:E8E2=IFERROR(INDEX($A$2:$A$10,AGGREGATE(15,6,MATCH($A$2:$A$10,$A$2:$A$10,0)/(MATCH($A$2:$A$10,$A$2:$A$10,0)=(ROW($A$2:$A$10)-ROW($A$2)+1)),ROWS($A$2:A2))),"")
10=$E2)/($B$2:$B$10=F$1),1)),"")[/XD][/XR][/RANGE]
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top