Stop your formulas from breaking by switching from grid-based coordinates (ROW) to stable table measurements (ROWS).
A well-known problem in numerical ecology is how to recombine presence-absence matrices without altering row and column totals. A few solutions have been proposed, but all of them present some issues ...