ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Variable Range (https://www.excelbanter.com/excel-discussion-misc-queries/226343-variable-range.html)

James C.

Variable Range
 
Does anyone know how to use variable's to set a range in Excel (Not in code
but actually in cells).

For instance I have a cell that does the following Sum(C8:H8) - Clearly this
sums the information in C8:H8. This represents a January - June data. I have
a million of these "sums" throughout my document and I want to be able to
change it so instead of a looking at 6 months, I could look at 3, 9, or
12...etc

My goal is to have two fields where the user could put the first and second
cell in.
Start
End


I would then put that in the formula (ie. Sum(Variable1: Variable2)), with
the variable representing the actual cell location

Can this be done?

Don Guillett

Variable Range
 
Look in the help index for INDIRECT

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"James C." wrote in message
...
Does anyone know how to use variable's to set a range in Excel (Not in
code
but actually in cells).

For instance I have a cell that does the following Sum(C8:H8) - Clearly
this
sums the information in C8:H8. This represents a January - June data. I
have
a million of these "sums" throughout my document and I want to be able to
change it so instead of a looking at 6 months, I could look at 3, 9, or
12...etc

My goal is to have two fields where the user could put the first and
second
cell in.
Start
End


I would then put that in the formula (ie. Sum(Variable1: Variable2)), with
the variable representing the actual cell location

Can this be done?



James C.

Variable Range
 
That is what I was looking for...

Thanks.

"Don Guillett" wrote:

Look in the help index for INDIRECT

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"James C." wrote in message
...
Does anyone know how to use variable's to set a range in Excel (Not in
code
but actually in cells).

For instance I have a cell that does the following Sum(C8:H8) - Clearly
this
sums the information in C8:H8. This represents a January - June data. I
have
a million of these "sums" throughout my document and I want to be able to
change it so instead of a looking at 6 months, I could look at 3, 9, or
12...etc

My goal is to have two fields where the user could put the first and
second
cell in.
Start
End


I would then put that in the formula (ie. Sum(Variable1: Variable2)), with
the variable representing the actual cell location

Can this be done?




Sheeloo[_5_]

Variable Range
 

Use
=SUM(INDIRECT(Start&":"&End))
with Start and End being NAMES containing the address of the start/end cells
or
=SUM(INDIRECT(A1&":"&A2))

with A1 containing C8 and A2 containing H8 to SUM(C8:H8)
-------------------------------------
Pl. click ''Yes'' if this was helpful...



"James C." wrote:

Does anyone know how to use variable's to set a range in Excel (Not in code
but actually in cells).

For instance I have a cell that does the following Sum(C8:H8) - Clearly this
sums the information in C8:H8. This represents a January - June data. I have
a million of these "sums" throughout my document and I want to be able to
change it so instead of a looking at 6 months, I could look at 3, 9, or
12...etc

My goal is to have two fields where the user could put the first and second
cell in.
Start
End


I would then put that in the formula (ie. Sum(Variable1: Variable2)), with
the variable representing the actual cell location

Can this be done?



All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com