A date test was noted to fail, with a formula intended for a cell ending up in the column header. This may help. Entering formulas reliably requires waiting for a particular focus state.