Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default function like INDIRECT to return a range?

Hello. I'm using an array formula that will only accept a finite range as a
parameter (e.g. A2:A999). The array formula will not accept a named range or
column reference (e.g. A:A). I'd like to specify the range dynamically
rather than hardcode it, for instance by using MATCH to find the first and
last rows with relevant data.

Something like INDIRECT would be perfect, but INDIRECT can only return a
cell reference, not a range (right?).

Any ideas? Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default function like INDIRECT to return a range?

Maybe you can use a range that grows and contracts depending on the entries:
http://contextures.com/xlNames01.html#Dynamic
(from Debra Dalgleish's site)

Wilba wrote:

Hello. I'm using an array formula that will only accept a finite range as a
parameter (e.g. A2:A999). The array formula will not accept a named range or
column reference (e.g. A:A). I'd like to specify the range dynamically
rather than hardcode it, for instance by using MATCH to find the first and
last rows with relevant data.

Something like INDIRECT would be perfect, but INDIRECT can only return a
cell reference, not a range (right?).

Any ideas? Thanks!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 61
Default function like INDIRECT to return a range?

Hi,

If your data are contiguous in the column(s) referenced in the array
formula, the following method may work.

Supposing your data range is in A2:A999:
In an empty cell (say P2) enter the formula, ="A"&COUNT(A:A)+1 (The '1' at
the end corresponds to one less than the starting row number of your data
range. You have to modify that number if the range starts at some other row).
Now P2 will show the cell reference for the last row (in this example, A999)
In your array formula enter A2:INDIRECT(P2) to mimic the actual range, i.e.,
A2:A999; however, the formula will be dynamic and if more rows are added to
column A, the INDIRECT function will take care of it.

I hope this works!

Best regards,
B. R. Ramachandran

"Wilba" wrote:

Hello. I'm using an array formula that will only accept a finite range as a
parameter (e.g. A2:A999). The array formula will not accept a named range or
column reference (e.g. A:A). I'd like to specify the range dynamically
rather than hardcode it, for instance by using MATCH to find the first and
last rows with relevant data.

Something like INDIRECT would be perfect, but INDIRECT can only return a
cell reference, not a range (right?).

Any ideas? Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default function like INDIRECT to return a range?

Dave Peterson wrote:

Maybe you can use a range that grows and contracts depending on the
entries:
http://contextures.com/xlNames01.html#Dynamic
(from Debra Dalgleish's site)


That's cute, I hadn't seen that before.

I got what I want by using MATCH in the OFFSET formula to find the first and
last occurrences of a start date and end date, then I used the dynamic range
in the array formula.

Superb, thanks a bunch!


Wilba wrote:

Hello. I'm using an array formula that will only accept a finite range as
a
parameter (e.g. A2:A999). The array formula will not accept a named range
or
column reference (e.g. A:A). I'd like to specify the range dynamically
rather than hardcode it, for instance by using MATCH to find the first
and
last rows with relevant data.

Something like INDIRECT would be perfect, but INDIRECT can only return a
cell reference, not a range (right?).

Any ideas? Thanks!



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default function like INDIRECT to return a range?

B. R.Ramachandran wrote:

If your data are contiguous in the column(s) referenced in the array
formula, the following method may work.

Supposing your data range is in A2:A999:
In an empty cell (say P2) enter the formula, ="A"&COUNT(A:A)+1 (The '1'
at
the end corresponds to one less than the starting row number of your data
range. You have to modify that number if the range starts at some other
row).
Now P2 will show the cell reference for the last row (in this example,
A999)
In your array formula enter A2:INDIRECT(P2) to mimic the actual range,
i.e.,
A2:A999; however, the formula will be dynamic and if more rows are added
to
column A, the INDIRECT function will take care of it.

I hope this works!


It would work for the way you have interpretted the question, but I didn't
make it clear what I meant - sorry, my fault.

A2:A999 is not the range I want, it's just an example of a the kind of
finite range that the array formula will accept.

The actual range I want is a subset from a column of dates in ascending
order, which includes everything from the first occurence of an arbitrary
start date to the last occurence of an arbitrary end date. Dave Peterson's
solution works brilliantly for what I want.

Thanks very much for taking the time to help me!


"Wilba" wrote:

Hello. I'm using an array formula that will only accept a finite range as
a
parameter (e.g. A2:A999). The array formula will not accept a named range
or
column reference (e.g. A:A). I'd like to specify the range dynamically
rather than hardcode it, for instance by using MATCH to find the first
and
last rows with relevant data.

Something like INDIRECT would be perfect, but INDIRECT can only return a
cell reference, not a range (right?).

Any ideas? Thanks!





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
Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions Mike Barlow Excel Worksheet Functions 7 May 21st 23 07:42 PM
can I use Indirect function within range definitons for names? surreyjed Excel Worksheet Functions 1 November 1st 07 07:14 PM
I would like a function to return a value that fits its range rpbsr Excel Worksheet Functions 4 September 7th 06 06:49 PM
Can INDIRECT return a range array? DaveO Excel Worksheet Functions 3 February 14th 06 02:25 PM
How to paste INDIRECT function to range of cells? Mike Williams Excel Worksheet Functions 4 March 18th 05 03:02 AM


All times are GMT +1. The time now is 01:04 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"