You either moved, cut, or deleted cells your formula was referencing. You'll have to rewrite the formula if you don't have an older file backup.
The #REF! Error is saying, "Hey, where'd the data I was referencing go?" If you just delete "#REF!" out of the formula like you did, it'll be like, "Um...ok? Still don't know what data you want me to reference tho because you pointed me to nothing."