does such a function exist?

mach3

Board Regular
Joined
Mar 24, 2002
Messages
245
let's say i have 2 arrays named Array1 and Array2.

in cell A1, is there a function i can write that returns the array's cell address?

for example in cell A1, =RETURNADDRESS(Array1)

returns '$B$904:$C$913 in cell A1.

maybe this is an easy question, but my brain is too fried to think about this. maybe the solution requires some alien form of an INDIRECT function?!?! thanks in advance.


mach3
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Jay Petrulis

MrExcel MVP
Joined
Mar 17, 2002
Messages
2,040
Hi,

Here is a simple UDF that seems to work.

<pre>Function ReturnAddress(r As Range) As String
ReturnAddress = r.Address
End Function</pre>

You may want to play around with the options available when using the .Address property.
 

mach3

Board Regular
Joined
Mar 24, 2002
Messages
245
reply to aladin:

i need this because i'm using some =offset(indirect(Array,#,#)) to pull data. it's kind of complicated, but i'm trying to find the simplest, most elegant way to pull data.

in any case, 1 of my formulas uses a vlookup(indirect()) function to return an array reference (e.g., '$B$1022:$C$1031), but because this array is at the bottom of the spreadsheet, everytime i add rows of data above, the array reference becomes obsolete. in other words, my '$B$1022:$C$1031 should now be '$B$1082:$C$1091.

i figure that if i use NAMES to refer to '$B$1022:$C$1031, then i don't have to worry about manually changing the row numbers.

i apologize for the ill-contrived explanation.

i'm not sure what a UDF is, however. user-defined function?


mach3
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
On 2002-10-15 16:15, mach3 wrote:
reply to aladin:

i need this because i'm using some =offset(indirect(Array,#,#)) to pull data. it's kind of complicated, but i'm trying to find the simplest, most elegant way to pull data.

in any case, 1 of my formulas uses a vlookup(indirect()) function to return an array reference (e.g., '$B$1022:$C$1031), but because this array is at the bottom of the spreadsheet, everytime i add rows of data above, the array reference becomes obsolete. in other words, my '$B$1022:$C$1031 should now be '$B$1082:$C$1091.

i figure that if i use NAMES to refer to '$B$1022:$C$1031, then i don't have to worry about manually changing the row numbers.

i apologize for the ill-contrived explanation.

i'm not sure what a UDF is, however. user-defined function?


mach3

You could use the so-called dynamic name ranges. There are many threads in which I described how to do it. For an example, see...

http://www.mrexcel.com/board/viewtopic.php?topic=16207&forum=2&7

It should not be difficult to apply the method to your relevant ranges.
 

Forum statistics

Threads
1,143,917
Messages
5,721,529
Members
422,369
Latest member
redinator

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