Use the $
prefix to indicate that cells and ranges should stay put when copy/paste/dragging:
=index(IndexValues!$B$1:$B$7;B2)
You can apply the $
to different parts of the cell address, so
$B2 means B should always be B when copied, but 2 can move relative B$2 means B can move relative, but 2 must remain the same