First, I would suggest that your thread title is too general. You may want to update it to reflect your specific question; a moderator may require it.

At any rate, you need to change your formula to use absolute references for the lookup of the quarter names. Change

O2:P13

to

$O$2:$P$13

in the two places it occurs. Then you can copy your formula to any row without making any other changes.