A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dynamic range in formula



 
 
Thread Tools Display Modes
  #1  
Old November 29th, 2003, 04:15 PM
Mr. Smith
external usenet poster
 
Posts: n/a
Default Dynamic range in formula

Hi.
Is it possible to read a named range that is written into a cell and base a
formula on it? I'll try to explain.

In cell B2 the value "data_rng1" is inserted.
In cell C2 the value "Mike" is inserted
In cell D2 the formula =VLOOKUP(C2;B2;1;FALSE) is inserted

Is there anyway that the formula in D2 would manage to understand that the
value in B2 is a range that it should use to lookup the value in C2?
God damn it would be a nice one.

Dearest
Mr. Smith


  #2  
Old November 29th, 2003, 04:23 PM
Peo Sjoblom
external usenet poster
 
Posts: n/a
Default Dynamic range in formula

One way

=VLOOKUP(C2;INDIRECT(B2);1,FALSE)

--

Regards,

Peo Sjoblom

"Mr. Smith" wrote in message
...
Hi.
Is it possible to read a named range that is written into a cell and base

a
formula on it? I'll try to explain.

In cell B2 the value "data_rng1" is inserted.
In cell C2 the value "Mike" is inserted
In cell D2 the formula =VLOOKUP(C2;B2;1;FALSE) is inserted

Is there anyway that the formula in D2 would manage to understand that the
value in B2 is a range that it should use to lookup the value in C2?
God damn it would be a nice one.

Dearest
Mr. Smith




  #3  
Old November 29th, 2003, 04:30 PM
Dave Peterson
external usenet poster
 
Posts: n/a
Default Dynamic range in formula

Try:
=vlookup(c2;indirect(b2);1;false)

But it looks as though you're trying to return the same value as you're looking
for (column = 1).

If you're looking for a match to see if that value is on the list:

=if(isnumber(match(c2;indirect(b2);0));"Yep";"nope ")
(if data_rng1 is a single column range)
or
if data_rng1 is multicolumn:
=IF(ISNUMBER(MATCH(C2;INDEX(INDIRECT(B2);;1),0));" yep";"nope")

(which looks longer than =vlookup! I'd use that, too.)







"Mr. Smith" wrote:

Hi.
Is it possible to read a named range that is written into a cell and base a
formula on it? I'll try to explain.

In cell B2 the value "data_rng1" is inserted.
In cell C2 the value "Mike" is inserted
In cell D2 the formula =VLOOKUP(C2;B2;1;FALSE) is inserted

Is there anyway that the formula in D2 would manage to understand that the
value in B2 is a range that it should use to lookup the value in C2?
God damn it would be a nice one.

Dearest
Mr. Smith


--

Dave Peterson

  #4  
Old November 29th, 2003, 04:38 PM
Mr. Smith
external usenet poster
 
Posts: n/a
Default Dynamic range in formula

Thank you both!
My example had some flaws to it regarding references, but anyway you helped
me out.

Mr. Smith


"Dave Peterson" wrote in message
...
Try:
=vlookup(c2;indirect(b2);1;false)

But it looks as though you're trying to return the same value as you're

looking
for (column = 1).

If you're looking for a match to see if that value is on the list:

=if(isnumber(match(c2;indirect(b2);0));"Yep";"nope ")
(if data_rng1 is a single column range)
or
if data_rng1 is multicolumn:
=IF(ISNUMBER(MATCH(C2;INDEX(INDIRECT(B2);;1),0));" yep";"nope")

(which looks longer than =vlookup! I'd use that, too.)







"Mr. Smith" wrote:

Hi.
Is it possible to read a named range that is written into a cell and

base a
formula on it? I'll try to explain.

In cell B2 the value "data_rng1" is inserted.
In cell C2 the value "Mike" is inserted
In cell D2 the formula =VLOOKUP(C2;B2;1;FALSE) is inserted

Is there anyway that the formula in D2 would manage to understand that

the
value in B2 is a range that it should use to lookup the value in C2?
God damn it would be a nice one.

Dearest
Mr. Smith


--

Dave Peterson



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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