Pointing to cells i cells back, thus returning contents

Mikexcel

New Member
Joined
Sep 15, 2002
Messages
5
I am working on an excel template. I want to eventually add columns BEFORE my cumulative column. I want to set it up so that my cumulative column updates certain text automatically after I insert columns. Basically, I want to know if there is a way to point to cells i places away from the cells that are calling the function, and are getting a return. Here is an example of what I am trying to do: I have a cumulative colunm that iteratively says June - August. When I insert extra columns before the cumulative column, I want this cell that says June - August, to say June - September automatically. Since I will update the cell that is say i=3 places before the cumulative cell and populate it with the text September. Programatically, this is simply done with a for loop, but it seems that excel provides no for loop function. A for loop would do it this way (psuedo code):

CONST CELLS_AWAY = 3;//or whatever
for (int i=1;i<=CELLS_AWAY; i++){
if (cell.contents != " ")
return cell.contents;
break;
}
This message was edited by Mikexcel on 2002-09-16 11:33
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Chris Davison

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,790
Welcome to the BOard Michael,

not sure what's up....

you can reply again with a full excel problem : just hit "reply" and type away

lots of people here to help out so go for it

:)
 

Mikexcel

New Member
Joined
Sep 15, 2002
Messages
5
sorry - i updated my original post. my mistake - please read the following update:

I am working on an excel template. I want to eventually add columns BEFORE my cumulative column. I want to set it up so that my cumulative column updates certain text automatically after I insert columns. Basically, I want to know if there is a way to point to cells i places away from the cells that are calling the function, and are getting a return. Here is an example of what I am trying to do: I have a cumulative colunm that iteratively says June - August. When I insert extra columns before the cumulative column, I want this cell that says June - August, to say June - September automatically. Since I will update the cell that is say i=3 places before the cumulative cell and populate it with the text September. Programatically, this is simply done with a for loop, but it seems that excel provides no for loop function. A for loop would do it this way (psuedo code):

CONST CELLS_AWAY = 3;//or whatever
for (int i=1;i<=CELLS_AWAY; i++){
if (cell.contents != " ")
return cell.contents;
break;
}
 

Forum statistics

Threads
1,144,439
Messages
5,724,369
Members
422,547
Latest member
Vision1291

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