I tried to make a replica of the Student Data Sheet on Sheet2.... I wanted to reference the same thing using the said formula but this time, combining the Male and Female.

here's the formula I tried to manipulate with:

=IF(G10="M",IF(ISERROR(INDEX('Student Data'!$C$7:$C$200,LARGE(INDEX(('Student Data'!$G$7:$G$200="M")*ROW(INDIRECT("1:"&ROWS('Student Data'!$G$7:$G$200))),0),COUNTIF('Student Data'!$G$7:$G$200,"M")-ROWS(B$12:B12)+1))),"",INDEX('Student Data'!$C$7:$C$200,LARGE(INDEX(('Student Data'!$G$7:$G$200="M")*ROW(INDIRECT("1:"&ROWS('Student Data'!$G$7:$G$200))),0),COUNTIF('Student Data'!$G$7:$G$200,"M")-ROWS(B$12:B12)+1))),IF(ISERROR(INDEX('Student Data'!$C$7:$C$200,LARGE(INDEX(('Student Data'!$G$7:$G$200="F")*ROW(INDIRECT("1:"&ROWS('Student Data'!$G$7:$G$200))),0),COUNTIF('Student Data'!$G$7:$G$200,"F")-ROWS(B$43:B43)+1))),"",INDEX('Student Data'!$C$7:$C$200,LARGE(INDEX(('Student Data'!$G$7:$G$200="F")*ROW(INDIRECT("1:"&ROWS('Student Data'!$G$7:$G$200))),0),COUNTIF('Student Data'!$G$7:$G$200,"F")-ROWS(B$43:B43)+1))))
Here's the new file I wanted to use it.. but gives me error...

Information Sheet_1.xls