Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag down formula and change COLUMN references instead of ROWS

Tags:

excel

drag

I have this formula in Excel, in row E5:

=SUM(Banco!H$5;Banco!H$6;Banco!H$8;Banco!H$9;Banco!H$10;Banco!H$11)

I need it to change the COLUMN references instead of ROWS when I drag it down (basically behave like I was dragging it across)... For example:

=SUM(Banco!I$5;Banco!I$6;Banco!I$8;Banco!I$9;Banco!I$10;Banco!I$11)
=SUM(Banco!J$5;Banco!J$6;Banco!J$8;Banco!J$9;Banco!J$10;Banco!J$11)
=SUM(Banco!K$5;Banco!K$6;Banco!K$8;Banco!K$9;Banco!K$10;Banco!K$11)

Any clues?

Thanks a lot!

like image 634
Marcelo Avatar asked Nov 12 '12 17:11

Marcelo


People also ask

How do you stop Excel from changing a range when you drag a formula down?

In the Formula Bar, put the cursor in the cell which you want to make it constant, then press the F4 key. In this case, I don't want the cell reference A1 to be adjusted with the formula moving, so I put the cursor on A1 in the formula, and then press F4.

How do you keep a row or column cell reference constant in a formula?

If you want to maintain the original cell reference when you copy it, you "lock" it by putting a dollar sign ($) before the cell and column references. For example, when you copy the formula =$A$2+$B$2 from C2 to D2, the formula stays exactly the same. This is an absolute reference.

How do you drag down formula while keeping horizontal cell reference continuity?

What you're describing is done by anchoring the portion of the address you want fixed (row and/or column), by prefixing it with $ . So if you want to drag your formula down and have the next cell be =A3-B1 , what you want fixed is the row 1 reference in column B. You would make the B2 cell formula =A2-B$1 .


1 Answers

... Use the offset function.

For example - Suppose you had a formula in row 1 and you wanted to reference Banco!H5, you could do something like:

=OFFSET(Banco!$G$5,0,ROW())

Now, as you drag it down, it will offset by the number of rows down you go.

So your new formula would look as follows:

=SUM(OFFSET(Banco!$G$5,0,ROW()),OFFSET(Banco!$G$6,0,ROW()),OFFSET(Banco!$G$8,0,ROW()),OFFSET(Banco!$G$9,0,ROW()),OFFSET(Banco!$G$10,0,ROW()),OFFSET(Banco!$G$11,0,ROW()))

Again, this assumes you are pasting this formula in row 1 (I know it's ugly, but you specified specific cells, so you have to specify each one separately)

Hope this makes sense

like image 95
John Bustos Avatar answered Oct 15 '22 13:10

John Bustos