Consolidate formula visibility blocks

Closes #20261.