Hi, abhi2611!
Replace each letter by the cell reference to that letter & "1". Ok, it's shorter to write than explain:
=IFERROR(CHOOSE(A1*2+B1+1,Z1,Y1,X1,W1),"")
=CHOOSE(MAX(MIN(5,A1*2+B1+1)),Z1,Y1,X1,W1,"")
where the 1st. one could be too this:
=IFERROR(INDEX(W1:Z1,1,5-CHOOSE(A1*2+B1+1),"")
Regards!