202

Lets say I have one cell A1, which I want to keep constant in a calculation. For example, I want to calculate a value like this:

=(B1+4)/(A1)

How do I make it so that if I drag that cell to make a calculation across cells in many rows, only the B1 value changes, while A1 always references that cell, instead of going to A2, A3, etc.?

1
  • In case you want lot of simple formulas check matrix formulas with ranges - you cannot change anything in that matrix without changing main formula or whole range. For example if I create simple formula {=B1:B15} indexes to B range will change only in case you cut/paste B1-B15 cells at once, if you move only some fields, base formula will remain =B1:B15
    – Jan
    Mar 6, 2020 at 12:33

8 Answers 8

362

Use this form:

=(B0+4)/$A$0

The $ tells excel not to adjust that address while pasting the formula into new cells.

Since you are dragging across rows, you really only need to freeze the row part:

=(B0+4)/A$0

Keyboard Shortcuts

Commenters helpfully pointed out that you can toggle relative addressing for a formula in the currently selected cells with these keyboard shortcuts:

  • Windows: f4
  • Mac: CommandT
5
  • 24
    It should be noted that the dollar sign keeps the adjacent character constant when dragging. $B1 (B will be kept constant and the 1 will count up) will be different to $B$1 (both B and 1 will remain constant)
    – Jonno_FTW
    Jan 28, 2010 at 17:40
  • 15
    added note: instead of manually typing the dollar signs you can toggle them by selecting the cell and pressing F4. Jan 29, 2010 at 0:00
  • 1
    Also I noticed that you don't need to freeze that row also. I had a top row label that I needed as a constant.
    – Pranjal
    Apr 20, 2016 at 16:02
  • This is my formula =IF(I4<>"",CONCATENATE("Compilation error ",I4),"")& CHAR(20)& IF(J4<>"",CONCATENATE(J$2," ",J4),"") and it is printing crap instead of what i wanted. it is printing `` Sep 1, 2017 at 5:17
  • 1
    @vipin8169 that sounds like a whole new question, Vipin, and the comments section of this answer is not the best place to ask for help on new questions.
    – Alex Brown
    Oct 1, 2017 at 3:27
29

There are two kinds of cell reference, and it's really valuable to understand them well.

One is relative reference, which is what you get when you just type the cell: A5. This reference will be adjusted when you paste or fill the formula into other cells.

The other is absolute reference, and you get this by adding dollar signs to the cell reference: $A$5. This cell reference will not change when pasted or filled.

A cool but rarely used feature is that row and column within a single cell reference may be independent: $A5 and A$5. This comes in handy for producing things like multiplication tables from a single formula.

10

To make your formula more readable, you could assign a Name to cell A0, and then use that name in the formula.

The easiest way to define a Name is to highlight the cell or range, then click on the Name box in the formula bar.

Then, if you named A0 "Rate" you can use that name like this:

=(B0+4)/(Rate)

See, much easier to read.

If you want to find Rate, click F5 and it appears in the GoTo list.

7

You put it as =(B0+4)/($A$0)

You can also go across WorkSheets with Sheet1!$a$0

0
6
=(B0+4)/($A$0)

$ means keep same (press a few times F4 after typing A4 to flip through combos quick!)

1
  • And someone finally talked about the keyboard shortcut! I actually use LibreOffice Calc but the shortcut is pretty similar, Shift+F4. Thanks!
    – Severo Raz
    Sep 4, 2013 at 3:53
3

Placing a $ in front of the row value to keep constant worked well for me. e.g.

=b2+a$1
1

Yeah. Just put the $ sign in front of your desired constant cell.

Like $A6 if you wish to just change the number 6 serially and keep a constant, or $A$6 if you do not want anything from that reference to change at all.

Example: Cell A5 contains my exchange rate. In B1 you put say ( = C1 * $A$1). when you fill B1 through B....... the value in A5 remains constant and the value in C1 increases serially.

I am by far not be good at teacher, but I hope this helps!!!! Wink wink

0

For future visitors - use this for range: ($A$1:$A$10)

Example
=COUNTIF($G$6:$G$9;J6)>0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.