Try this:
For Current Year Table (Change Total Mark Column header to Total Marks)
Step 1:
In Cell A3 put below formula and Press enter then select A3:A17 and press Ctrl + Shift + Enter:
Code:
=IFERROR(INDEX($A$20:$F$73,IFERROR(SMALL(IF(($F$20:$F$73="Pass"),(ROW($A$20:$A$73)-ROW($A$20))+1,""),ROW(INDIRECT("1:" & COUNTA($A$20:$A$73)))),""),MATCH(A$2,$A$19:$F$19,0)),"")
Select range A3:A17 and drag it to next two columns B3:B17 and C3:C17
Step 2:
In Cell D3 put below formula and Press enter then select D3:D17 and press Ctrl + Shift + Enter:
Code:
=IFERROR(INDEX($A$20:$F$73,IFERROR(SMALL(IF(($F$20:$F$73="Fail"),(ROW($A$20:$A$73)-ROW($A$20))+1,""),ROW(INDIRECT("1:" & COUNTA($A$20:$A$73)))),""),MATCH(D$2,$A$19:$F$19,0)),"")
Select range D3:D17 and drag it to next two columns E3:E17 and F3:F17
For 5 Year Table (Change Total Mark Column header to Total Marks)
Step 1:
In Cell H3 put below formula and Press enter then select H3:H17 and press Ctrl + Shift + Enter:
Code:
=IFERROR(INDEX($H$20:$M$73,IFERROR(SMALL(IF(($M$20:$M$73="Pass"),(ROW($H$20:$H$73)-ROW($H$20))+1,""),ROW(INDIRECT("1:" & COUNTA($H$20:$H$73)))),""),MATCH(A$2,$H$19:$M$19,0)),"")
Select range H3:H17 and drag it to next two columns I3:I17 and J3:J17
Step 2:
In Cell K3 put below formula and Press enter then select K3:K17 and press Ctrl + Shift + Enter:
Code:
=IFERROR(INDEX($H$20:$M$73,IFERROR(SMALL(IF(($M$20:$M$73="Fail"),(ROW($H$20:$H$73)-ROW($H$20))+1,""),ROW(INDIRECT("1:" & COUNTA($H$20:$H$73)))),""),MATCH(D$2,$H$19:$M$19,0)),"")
Select range K3:K17 and drag it to next two columns L3:L17 and M3:M17
Bookmarks