Say I have 2 columns: (this is extremely simplified)
I can put B2 = A2*1.2, then drag and drop B2 down...
and it fills all the other cells, which is perfect.
But can I put this multiplier (1.2
) somewhere as a "constant"? (for clarity and being easily editable)
Say I put it in E1, and set B2 = A2*E1.
Now I can't drag and drop anymore (because E1 becomes E2 E3 and so on)
In this example, is there a way to make E1 stay as you drag it down?
If you copy the formula down Column C, both cell references will change (A2 to A3 and B2 to B3, etc.). Say you want to keep cell A2 constant. To do that, click on the cell reference in the formula bar (A2), and enter $ before column and row ($A$2). You can also press F4 on the keyboard to make variable cell constant.
You can use an absolute reference to keep a row and/or column constant in the formula. An absolute reference is designated in the formula by the addition of a dollar sign ($). It can precede the column reference, the row reference, or both.
To add a value to a range of cells, click on the cell where you want to display the result, and enter = (equal) and the cell reference of the first number then + (plus) and the number you want to add.
Use an absolute cell reference or a named range
Instead of E1, which is a relative cell reference, use $E$1 which is an absolute cell reference.
An alternative is to to assign a name to the cell E1, let say, "constant"
In the first case the formula will be
=A2*$E$1
In the second case
=A2*constant
Can you try this in your formula?
Cell B2 type
=A2*$E$1
Then there is no need to drag it down on column E, it will all follow E1. I believe this solves the problem.
If you really want to drag it down, then why not just put Cell E2
=E1
So that even when you drag, the value will remain 1.2
I understand that you are asking for "A “constant” in Google spreadsheet?" and later on a "drag down" solution.
You can use the accepted answer, OR ...
Instead of having to drag down (increasing the number of formulas)
B2
=ArrayFormula(A2:A6*E1)
You can even use it for future entries or now blank cells.
=ArrayFormula(IF(A2:A11<>"",A2:A11*E1,""))
The ArrayFormula
will apply the calculation cell*E1
in every single row, IF
the cell is not empty/blank ""
.IF
it is a blank cell it will return a blank cell ""
.
Functions used:
ArrayFormula
IF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With