Prevent cell numbers from incrementing in a formula in Excel

后端 未结 4 1103
囚心锁ツ
囚心锁ツ 2021-02-02 04:56

I have a formula in Excel that needs to be run on several rows of a column based on the numbers in that row divided by one constant. When I copy that formula and apply it to eve

4条回答
  •  再見小時候
    2021-02-02 05:56

    In Excel 2013 and resent versions, you can use F2 and F4 to speed things up when you want to toggle the lock.

    About the keys:

    • F2 - With a cell selected, it places the cell in formula edit mode.
    • F4 - Toggles the cell reference lock (the $ signs).

    • Example scenario with 'A4'.

      • Pressing F4 will convert 'A4' into '$A$4'
      • Pressing F4 again converts '$A$4' into 'A$4'
      • Pressing F4 again converts 'A$4' into '$A4'
      • Pressing F4 again converts '$A4' back to the original 'A4'

    How To:

    • In Excel, select a cell with a formula and hit F2 to enter formula edit mode. You can also perform these next steps directly in the Formula bar. (Issue with F2 ? Double check that 'F Lock' is on)

      • If the formula has one cell reference;
        • Hit F4 as needed and the single cell reference will toggle.
      • If the forumla has more than one cell reference, hitting F4 (without highlighting anything) will toggle the last cell reference in the formula.
      • If the formula has more than one cell reference and you want to change them all;
        • You can use your mouse to highlight the entire formula or you can use the following keyboard shortcuts;
        • Hit End key (If needed. Cursor is at end by default)
        • Hit Ctrl + Shift + Home keys to highlight the entire formula
        • Hit F4 as needed
      • If the formula has more than one cell reference and you only want to edit specific ones;
        • Highlight the specific values with your mouse or keyboard ( Shift and arrow keys) and then hit F4 as needed.

    Notes:

    • These notes are based on my observations while I was looking into this for one of my own projects.
    • It only works on one cell formula at a time.
    • Hitting F4 without selecting anything will update the locking on the last cell reference in the formula.
    • Hitting F4 when you have mixed locking in the formula will convert everything to the same thing. Example two different cell references like '$A4' and 'A$4' will both become 'A4'. This is nice because it can prevent a lot of second guessing and cleanup.
    • Ctrl+A does not work in the formula editor but you can hit the End key and then Ctrl + Shift + Home to highlight the entire formula. Hitting Home and then Ctrl + Shift + End.
    • OS and Hardware manufactures have many different keyboard bindings for the Function (F Lock) keys so F2 and F4 may do different things. As an example, some users may have to hold down you 'F Lock' key on some laptops.
    • 'DrStrangepork' commented about F4 actually closes Excel which can be true but it depends on what you last selected. Excel changes the behavior of F4 depending on the current state of Excel. If you have the cell selected and are in formula edit mode (F2), F4 will toggle cell reference locking as Alexandre had originally suggested. While playing with this, I've had F4 do at least 5 different things. I view F4 in Excel as an all purpose function key that behaves something like this; "As an Excel user, given my last action, automate or repeat logical next step for me".

提交回复
热议问题