Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VLookup and Indirect

I am currently using INDIRECT to get the lookup_value for VLOOKUP

The formula I am using is:
=VLOOKUP(INDIRECT(D2),INDIRECT("'"&B2&"'!A2:F20"), 2,)

where D2 is a text string (example:Akan 1-1)

When I use the above formula I get #Ref
If I place D2 in quotes:
=VLOOKUP(INDIRECT("D2"),INDIRECT("'"&B2&"'!A2:F20" ),2,).

The correct result is returned. However this locks the reference to D2. I
need to be able to use this code so that If I move it to the 3rd column it
will read D3 and I would prefer not to change the number each time.

I have also tried the following formulas and they all return #Ref for the
lookup_value.
=VLOOKUP(INDIRECT("""&D2&"""),INDIRECT("'"&B2&"'!A 2:F20"),2,)
=VLOOKUP(INDIRECT(""""&D2&""""),INDIRECT("'"&B2&"' !A2:F20"),2,)


I used the formula auditing to determine where the problem is the
lookup_value. The rest of the formula works just fine.

Thanks in advance for the help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default VLookup and Indirect

Try
=VLOOKUP(D2,INDIRECT("'"&B2&"'!A2:F20"),2,0)

If this post helps click Yes
---------------
Jacob Skaria


"Will Cross" wrote:

I am currently using INDIRECT to get the lookup_value for VLOOKUP

The formula I am using is:
=VLOOKUP(INDIRECT(D2),INDIRECT("'"&B2&"'!A2:F20"), 2,)

where D2 is a text string (example:Akan 1-1)

When I use the above formula I get #Ref
If I place D2 in quotes:
=VLOOKUP(INDIRECT("D2"),INDIRECT("'"&B2&"'!A2:F20" ),2,).

The correct result is returned. However this locks the reference to D2. I
need to be able to use this code so that If I move it to the 3rd column it
will read D3 and I would prefer not to change the number each time.

I have also tried the following formulas and they all return #Ref for the
lookup_value.
=VLOOKUP(INDIRECT("""&D2&"""),INDIRECT("'"&B2&"'!A 2:F20"),2,)
=VLOOKUP(INDIRECT(""""&D2&""""),INDIRECT("'"&B2&"' !A2:F20"),2,)


I used the formula auditing to determine where the problem is the
lookup_value. The rest of the formula works just fine.

Thanks in advance for the help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VLookup and Indirect

That worked Thanks

I guess that's what I get for making it complicated.

"Jacob Skaria" wrote:

Try
=VLOOKUP(D2,INDIRECT("'"&B2&"'!A2:F20"),2,0)

If this post helps click Yes
---------------
Jacob Skaria


"Will Cross" wrote:

I am currently using INDIRECT to get the lookup_value for VLOOKUP

The formula I am using is:
=VLOOKUP(INDIRECT(D2),INDIRECT("'"&B2&"'!A2:F20"), 2,)

where D2 is a text string (example:Akan 1-1)

When I use the above formula I get #Ref
If I place D2 in quotes:
=VLOOKUP(INDIRECT("D2"),INDIRECT("'"&B2&"'!A2:F20" ),2,).

The correct result is returned. However this locks the reference to D2. I
need to be able to use this code so that If I move it to the 3rd column it
will read D3 and I would prefer not to change the number each time.

I have also tried the following formulas and they all return #Ref for the
lookup_value.
=VLOOKUP(INDIRECT("""&D2&"""),INDIRECT("'"&B2&"'!A 2:F20"),2,)
=VLOOKUP(INDIRECT(""""&D2&""""),INDIRECT("'"&B2&"' !A2:F20"),2,)


I used the formula auditing to determine where the problem is the
lookup_value. The rest of the formula works just fine.

Thanks in advance for the help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default VLookup and Indirect

Hi Will
On Sheet1 I have this data starting in A2
XXX Sheet3 XXX a4 3
cat
dog
----
On Sheet 3 starting in A3 I have
cat 1 4 7 10 13
cow 2 5 8 11 14
dog 3 6 9 12 15
mule 4 7 10 13 16

The formula in E2 that returns the value 3 is
=VLOOKUP(INDIRECT(D2),INDIRECT("'"&B2&"'!A2:F20"), 2,)

Of course, I could use
=VLOOKUP(INDIRECT(D2),INDIRECT("'"&B2&"'!A2:F20"), 2,FALSE)
and then the animals would not need to be in alphabetical order.

Changing the value in D2 from a4 to a3 give a 1 in E2, while a5 give a 4.
So your formula is working without quotes around D2

Hard to say why you have trouble without seeing your data.
Feel free to send me a sample file - get my addy from my website.
Please copy your original message to the private email you send me
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"Will Cross" <Will wrote in message
...
I am currently using INDIRECT to get the lookup_value for VLOOKUP

The formula I am using is:
=VLOOKUP(INDIRECT(D2),INDIRECT("'"&B2&"'!A2:F20"), 2,)

where D2 is a text string (example:Akan 1-1)

When I use the above formula I get #Ref
If I place D2 in quotes:
=VLOOKUP(INDIRECT("D2"),INDIRECT("'"&B2&"'!A2:F20" ),2,).

The correct result is returned. However this locks the reference to D2.
I
need to be able to use this code so that If I move it to the 3rd column it
will read D3 and I would prefer not to change the number each time.

I have also tried the following formulas and they all return #Ref for the
lookup_value.
=VLOOKUP(INDIRECT("""&D2&"""),INDIRECT("'"&B2&"'!A 2:F20"),2,)
=VLOOKUP(INDIRECT(""""&D2&""""),INDIRECT("'"&B2&"' !A2:F20"),2,)


I used the formula auditing to determine where the problem is the
lookup_value. The rest of the formula works just fine.

Thanks in advance for the help.


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
VLOOKUP with INDIRECT AirgasRob Excel Discussion (Misc queries) 5 June 24th 08 09:38 PM
Indirect VLookup mcp201 Excel Discussion (Misc queries) 1 May 2nd 08 09:50 PM
vlookup with indirect Tonto Excel Discussion (Misc queries) 4 September 11th 06 11:00 PM
vlookup? indirect? streetboarder Excel Discussion (Misc queries) 4 April 19th 06 06:36 PM
Indirect Vlookup with RC[-1] outwest Excel Worksheet Functions 6 March 12th 06 10:08 PM


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