View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
S Davis S Davis is offline
external usenet poster
 
Posts: 138
Default Using the return from ADDRESS within another formula?

Thanks everyone for the responses. I may have been a bit unclear:

What I was trying to achieve by using the ADDRESS command was the
return of "$B$33". This literal string I wanted to then use in a
formula. Basically what I wanted to achieve was this:

=offset($B$33,1,1)

As you can see in the formula above, $B$33 is the reference cell
(where the offset starts from). I was attempting to use the ADDRESS
function to dynamically change the reference starter cell so that,
based on other criteria, the location of the start of the offset could
shift around the worksheet. So, $B$33 could be anything really based
on other criteria. But we'll use $B$33 for discussion.

Essentially, this then becomes:

=offset(ADDRESS(MATCH(F14,commandsxp,0)+2,MATCH(E1 4,roomsxp,0)+1),1,1)
or (just to make it easy to read)
=offset(address(33,2),1,1)

[for simplicity, address(33,2) is equivalent to the dynamic shifting
one]

I use the simple example just to illustrate the point. Try =offset
(address(33,2),1,1) in Excel.

It does not work. This is because ADRESS returns a text string which
can not literally be used within a formula as a reference, or at
least, I have not yet found a way other than through VBA. The same way
you could not expect =offset("$B$33",1,1) to work.

As for indirect, combining indirect and address is useful in a lot of
situations but not here. Simply because, indirect flows through what
is returned by address. If $B$33 contained the word "dog" for
instance, my offset formula would end up being:

=offset(dog,1,1)

Much the same way, if A1 were to contain:

=ADDRESS(MATCH(F14,commandsxp,0)+2,MATCH(E14,rooms xp,0)+1)

.... and return "$B$33", =offset(A1,1,1) would not work as it starts
the offset from A1, not the contents of A1.

Hope that clears that up.
Thanks for the suggestions with index. Im mucking around with it
because Im plainly working with a terrible data setup, trying to
basically do a lookup from a lookup from a lookup. Augh.