Hi,

Try this array formula (confirm with CTRL+SHIFT+ENTER, not just ENTER):

=MEDIAN(IF($A$2:$A$9="Sam",$B$2:$E$9))

Regards