5.2 Nonrelocatable references

C-y relocates all cell-references in a pasted formula, while C-u C-y relocates none of the cell-references. What about mixed cases?

The best way is to rename cells that you do not want to be relocatable by using ses-rename-cell. Cells that do not have an A1-like name style are not relocated on yank. Using this method, the concerned cells won’t be relocated whatever formula they appear in. Please note however that when a formula contains some range (ses-range cell1 cell2) then in the yanked formula each range bound cell1 and cell2 are relocated, or not, independently, depending on whether they are A1-like or renamed.

An alternative method is to use

(symbol-value 'B3)

to make an absolute reference. The formula relocator skips over quoted things, so this will not be relocated when pasted or when rows/columns are inserted/deleted. However, B3 will not be recorded as a dependency of this cell, so this cell will not be updated automatically when B3 is changed, this is why using ses-rename-cell is most of the time preferable.

The variables row and col are dynamically bound while a cell formula is being evaluated. You can use

(ses-cell-value row 0)

to get the value from the leftmost column in the current row. This kind of dependency is also not recorded.