No the real problem was you use INDEX and specified the number of rows to use rather than columns.

this
C8:INDEX(C8:H8,COUNTA(C8:H8))

should have been
C8:INDEX(C8:H8,1,COUNTA(C8:H8))