Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent cell numbers from incrementing in a formula in Excel

Tags:

excel

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 every cell in the range, all of the cell numbers increment with the row, including the constant. So:

B1=127 C4='=IF(B4<>"",B4/B1,"")' 

If I copy cell C4 and paste it down column C, the formula becomes

=IF(B5<>"",B5/B2,"") =IF(B6<>"",B6/B3,"") etc. 

when what I need it to be is

=IF(B5<>"",B5/B1,"") =IF(B6<>"",B6/B1,"") etc. 

Is there a simple way to prevent the expression from incrementing?

like image 530
DrStrangepork Avatar asked Mar 04 '14 19:03

DrStrangepork


People also ask

How do you stop Excel incrementing numbers in formulas?

The number won't increase automatically if we hold down the Ctrl key while dragging the AutoFill handle in Excel. In our case, please select the Cell A2; hold down the Ctrl key which will change the cursor to a double-cross ; and then drag the AutoFill handle down to the cells as you need.

How do I stop cells from changing numbers in Excel?

If you do not want cell references to change when you copy a formula, then make those cell references absolute cell references. Place a "$" before the column letter if you want that to always stay the same. Place a "$" before a row number if you want that to always stay the same.

How do you keep one cell constant in a formula?

1. Select the cell with the formula you want to make it constant. 2. In the Formula Bar, put the cursor in the cell which you want to make it constant, then press the F4 key.

How do you lock a cell number in a formula?

For locking the cell reference of a single formula cell, the F4 key can help you easily. Select the formula cell, click on one of the cell reference in the Formula Bar, and press the F4 key. Then the selected cell reference is locked.


1 Answers

There is something called 'locked reference' in excel which you can use for this, and you use $ symbols to lock a range. For your example, you would use:

=IF(B4<>"",B4/B$1,"") 

This locks the 1 in B1 so that when you copy it to rows below, 1 will remain the same.

If you use $B$1, the range will not change when you copy it down a row or across a column.

like image 175
Jerry Avatar answered Sep 18 '22 12:09

Jerry