Offset Function Question

MikeL

Active Member
Joined
Mar 17, 2002
Messages
440
Hello,
I am using Offset for the first time. I would like the formula to sum cells E2:G2 for a total of "116"

It seems I misunderstand the formula as it moves 2 cells to the left of the G2 and returns "1"

Thanks in advance.


<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">jan</td><td style=";">feb</td><td style=";">mar</td><td style=";">apr</td><td style=";">may</td><td style=";">june</td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">5</td><td style="text-align: right;;">10</td><td style="text-align: right;;">4</td><td style="text-align: right;background-color: #FFFF00;;">1</td><td style="text-align: right;background-color: #FFFF00;;">100</td><td style="text-align: right;background-color: #FFFF00;;">15</td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="font-weight: bold;text-align: right;color: #222222;;">1</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">H5</th><td style="text-align:left">=OFFSET(<font color="Blue">G2,0,-2</font>)</td></tr></tbody></table></td></tr></table><br />
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
Hello,
I am using Offset for the first time. I would like the formula to sum cells E2:G2 for a total of "116"

It seems I misunderstand the formula as it moves 2 cells to the left of the G2 and returns "1"

Thanks in advance.


Excel 2007
BCDEFGH
1janfebmaraprmayjune
25104110015
3
4
51

<colgroup><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
H5=OFFSET(G2,0,-2)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

You are asking for the value that is 2 columns to the left of the column of G2.

Try...

=SUM(OFFSET(G2,0,0,1,-3))
 

MikeL

Active Member
Joined
Mar 17, 2002
Messages
440
Am following up on this...

Why is the optional last value a negative? Per MS support, it has to be positive.

http://support.microsoft.com/kb/324991


Enter the following formulas into cell E2 (or any available blank cell):


=OFFSET(C2,2,-1,1,1)
C2 - The referenced cell.
2 - Indicates the number of rows to move. Positive numbers mean move down, and negative numbers mean move up.
-1 - Indicates the number of columns to move. Positive numbers mean move to the right, and negative numbers mean move to the left.
1 (second last value) - (Optional.) Indicates how many rows of data to return. This number must be a positive number.
1 (last value) - (Optional.) Indicates how many columns of data to return. This number must be a positive number.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
Am following up on this...

Why is the optional last value a negative? Per MS support, it has to be positive.

http://support.microsoft.com/kb/324991


Enter the following formulas into cell E2 (or any available blank cell):


=OFFSET(C2,2,-1,1,1)
C2 - The referenced cell.
2 - Indicates the number of rows to move. Positive numbers mean move down, and negative numbers mean move up.
-1 - Indicates the number of columns to move. Positive numbers mean move to the right, and negative numbers mean move to the left.
1 (second last value) - (Optional.) Indicates how many rows of data to return. This number must be a positive number.
1 (last value) - (Optional.) Indicates how many columns of data to return. This number must be a positive number.

If you take E2 as the start address and you intend to sum E2:G2, the formula with OFFSET would look like:

=SUM(OFFSET(E2,0,0,1,3))

If you take G2 as the address to start with and you want still to sum E2:G2, the formla becomes:


=SUM(OFFSET(G2,0,0,1,-3))

where -3 means: sum from 3 cells to the left of G2 (including G2) up to G2.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,321
Messages
5,600,950
Members
414,417
Latest member
Nobu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top