Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ken Ken is offline
external usenet poster
 
Posts: 590
Default Variable Cell Range Reference

How do I refer to a range of values when one component is a variable? For
instance, lets say I want the MAX value of the cells from cell A5 to A(6+x)
where x is a variable ... if x=4 then I would be finding the MAX value in the
cells from A5 to A10. How do I structure this formula in Excel?
--
Ken
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Variable Cell Range Reference

one way:

=MAX(OFFSET($A$5,0,0,$B$1,1))

B1 contains number of rows to be included: for your example it would be 6
(A5 to A10 inclusive)

"Ken" wrote:

How do I refer to a range of values when one component is a variable? For
instance, lets say I want the MAX value of the cells from cell A5 to A(6+x)
where x is a variable ... if x=4 then I would be finding the MAX value in the
cells from A5 to A10. How do I structure this formula in Excel?
--
Ken

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default Variable Cell Range Reference

How do I refer to a range of values when one component is a variable? For
instance, lets say I want the MAX value of the cells from cell A5 to
A(6+x)
where x is a variable ... if x=4 then I would be finding the MAX value in
the
cells from A5 to A10. How do I structure this formula in Excel?


This should work...

=MAX(INDIRECT("A5:A"&(6+X1)))

where I stored your "variable" in cell X1.

Rick

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Variable Cell Range Reference

A non-volatile approach.

from cell A5 to A(6+x)


If you want to use that logic:

=MAX(A5:INDEX(A:A,6+B1))

Where B1 = your variable

Or, you could change this logic A(6+x) and instead use the actual row number
you're interested in:

So, if B1 = 4, then 6+B1 = 10

Instead, make B1 = 10

=MAX(A5:INDEX(A:A,B1))

Note that using this approach if B1 is empty the formula will return the max
from the entire column A.

--
Biff
Microsoft Excel MVP


"Ken" wrote in message
...
How do I refer to a range of values when one component is a variable? For
instance, lets say I want the MAX value of the cells from cell A5 to
A(6+x)
where x is a variable ... if x=4 then I would be finding the MAX value in
the
cells from A5 to A10. How do I structure this formula in Excel?
--
Ken



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP variable range cell reference Ohp Excel Worksheet Functions 2 July 3rd 07 02:52 PM
Variable range reference Kyle Szukaitis Excel Discussion (Misc queries) 1 October 21st 05 03:10 AM
A function to get a variable row reference for range in XNPV funct Tex1960 Excel Worksheet Functions 6 August 1st 05 11:20 PM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"