okay i think i get what you mean, try this :

(cell F2) =TTEST(IF(C2:C17="H1",A2:A17),IF(C2:C17="H1",B2:B17),2,1), "<shift>+<cntrl>+<Enter>"
(cell F3) =TTEST(IF(C2:C17="H2",A2:A17),IF(C2:C17="H2",B2:B17),2,1), "<shift>+<cntrl>+<Enter>"
(cell F4) =TTEST(IF(C2:C17="H3",A2:A17),IF(C2:C17="H3",B2:B17),2,1), "<shift>+<cntrl>+<Enter>"

these are array formulas, so you have to use the "<shift>+<cntrl>+<Enter>" to enter them
hope this helps