Match works on a single column or row, it does not work on an array like that

You could perhaps try something like this?
=IFERROR(MATCH(A7,A1:A5,0),MATCH(A7,B1:B5,0))