We know that great trick that you can select part of the formula and see it values by pressing F9. See the below snip where I have selected part of the formula (see shaded area) and pressed F9 to see its values.
Now, if I press enter that part of the formula gets converted to values and formula doesn't get restored. (see the below snip)
How to Prevent this
1. If you have not pressed Enter, press ESC after using F9 to see its values and formula will get restored.
2. If you have pressed Enter, press CTRL+Z (Undo) and formula will get restored. (You need to press CTRL+Z after pressing enter. If there have been many intermediate steps, you need to press CTRL+Z repeatedly to undo this step. Of course, CTRL+Z has its own limitations in terms of retracing steps)