Anchor scroll offset

Can we simplify this calculation?