Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default formula construction w/ vba

Hi all,

i'm trying to construct a formula that will look like this in excel
=vlookup(O4,Month_A&"_A",2, false)

Month_A (R2) contains a drop-down data validation with a list of months
the user selects the month and then the formula takes that
appends _A to it
and that will be the name of the range it will lookup in

doing it the way i am, produces a string that apparently excel doesn't like,
or know what to do with.

is there a way to convert the string back to a reference that excel will
understand?

tia

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default formula construction w/ vba

=If(len(r2),vlookup(O4,Indirect(R2&"_A"),2, false),"")

--
Regards,
Tom Ogilvy


"Gixxer_J_97" wrote in message
...
Hi all,

i'm trying to construct a formula that will look like this in excel
=vlookup(O4,Month_A&"_A",2, false)

Month_A (R2) contains a drop-down data validation with a list of months
the user selects the month and then the formula takes that
appends _A to it
and that will be the name of the range it will lookup in

doing it the way i am, produces a string that apparently excel doesn't

like,
or know what to do with.

is there a way to convert the string back to a reference that excel will
understand?

tia

J



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default formula construction w/ vba

Hi Tom,

does it matter that
Indirect(R2&"_A") refers to a range larger than just one cell?
i'm getting a #REF error on
Indirect(R2&"_A")

J

"Tom Ogilvy" wrote:

=If(len(r2),vlookup(O4,Indirect(R2&"_A"),2, false),"")

--
Regards,
Tom Ogilvy


"Gixxer_J_97" wrote in message
...
Hi all,

i'm trying to construct a formula that will look like this in excel
=vlookup(O4,Month_A&"_A",2, false)

Month_A (R2) contains a drop-down data validation with a list of months
the user selects the month and then the formula takes that
appends _A to it
and that will be the name of the range it will lookup in

doing it the way i am, produces a string that apparently excel doesn't

like,
or know what to do with.

is there a way to convert the string back to a reference that excel will
understand?

tia

J




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default formula construction w/ vba

Assume R2 contains the textstring

July

and you have a table of values named July_A2, then

Indirect(R2 & "_A")

would return a reference to that table of values which Vlookup is looking
for as the second argument.

That is what I understood you to say the situation is. Using the situation
I described, it works fine for me.

--
Regards,
Tom Ogilvy

"Gixxer_J_97" wrote in message
...
Hi Tom,

does it matter that
Indirect(R2&"_A") refers to a range larger than just one cell?
i'm getting a #REF error on
Indirect(R2&"_A")

J

"Tom Ogilvy" wrote:

=If(len(r2),vlookup(O4,Indirect(R2&"_A"),2, false),"")

--
Regards,
Tom Ogilvy


"Gixxer_J_97" wrote in message
...
Hi all,

i'm trying to construct a formula that will look like this in excel
=vlookup(O4,Month_A&"_A",2, false)

Month_A (R2) contains a drop-down data validation with a list of

months
the user selects the month and then the formula takes that
appends _A to it
and that will be the name of the range it will lookup in

doing it the way i am, produces a string that apparently excel doesn't

like,
or know what to do with.

is there a way to convert the string back to a reference that excel

will
understand?

tia

J






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default formula construction w/ vba

Yup - thats exactly what i meant and what i wanted to do.

Having trouble figuring out why the #REF

i double checked the validity of the ranges using F5 and also in Insert -
Name - Define: they're all good.

there's got to be something else i'm not seeing

thanks again Tom, you're awesome!

J

"Tom Ogilvy" wrote:

Assume R2 contains the textstring

July

and you have a table of values named July_A2, then

Indirect(R2 & "_A")

would return a reference to that table of values which Vlookup is looking
for as the second argument.

That is what I understood you to say the situation is. Using the situation
I described, it works fine for me.

--
Regards,
Tom Ogilvy

"Gixxer_J_97" wrote in message
...
Hi Tom,

does it matter that
Indirect(R2&"_A") refers to a range larger than just one cell?
i'm getting a #REF error on
Indirect(R2&"_A")

J

"Tom Ogilvy" wrote:

=If(len(r2),vlookup(O4,Indirect(R2&"_A"),2, false),"")

--
Regards,
Tom Ogilvy


"Gixxer_J_97" wrote in message
...
Hi all,

i'm trying to construct a formula that will look like this in excel
=vlookup(O4,Month_A&"_A",2, false)

Month_A (R2) contains a drop-down data validation with a list of

months
the user selects the month and then the formula takes that
appends _A to it
and that will be the name of the range it will lookup in

doing it the way i am, produces a string that apparently excel doesn't
like,
or know what to do with.

is there a way to convert the string back to a reference that excel

will
understand?

tia

J








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default formula construction w/ vba

All I can say is that the approach is sound. I suspect if you look closely,
there is some error in your implementation. Try getting it working in a
new workbook in a simplified environment and perhaps you will see what you
need to do.

--
Regards,
Tom Ogilvy

"Gixxer_J_97" wrote in message
...
Yup - thats exactly what i meant and what i wanted to do.

Having trouble figuring out why the #REF

i double checked the validity of the ranges using F5 and also in Insert -
Name - Define: they're all good.

there's got to be something else i'm not seeing

thanks again Tom, you're awesome!

J

"Tom Ogilvy" wrote:

Assume R2 contains the textstring

July

and you have a table of values named July_A2, then

Indirect(R2 & "_A")

would return a reference to that table of values which Vlookup is

looking
for as the second argument.

That is what I understood you to say the situation is. Using the

situation
I described, it works fine for me.

--
Regards,
Tom Ogilvy

"Gixxer_J_97" wrote in message
...
Hi Tom,

does it matter that
Indirect(R2&"_A") refers to a range larger than just one cell?
i'm getting a #REF error on
Indirect(R2&"_A")

J

"Tom Ogilvy" wrote:

=If(len(r2),vlookup(O4,Indirect(R2&"_A"),2, false),"")

--
Regards,
Tom Ogilvy


"Gixxer_J_97" wrote in message
...
Hi all,

i'm trying to construct a formula that will look like this in

excel
=vlookup(O4,Month_A&"_A",2, false)

Month_A (R2) contains a drop-down data validation with a list of

months
the user selects the month and then the formula takes that
appends _A to it
and that will be the name of the range it will lookup in

doing it the way i am, produces a string that apparently excel

doesn't
like,
or know what to do with.

is there a way to convert the string back to a reference that

excel
will
understand?

tia

J








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
I am looking for formula to calculate escalation on construction Ronnie Excel Discussion (Misc queries) 2 April 26th 23 07:44 PM
formula construction Robert-the-Bruce New Users to Excel 7 June 9th 07 08:12 PM
Efficient Array Formula Construction Mike Moore Excel Discussion (Misc queries) 8 July 24th 06 12:37 AM
formula construction Old Red One Excel Discussion (Misc queries) 8 February 10th 06 01:02 PM
formula construction Gixxer_J_97[_2_] Excel Programming 2 February 15th 05 02:43 PM


All times are GMT +1. The time now is 06:03 PM.

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

About Us

"It's about Microsoft Excel"