Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 54
Default Need help please with VLOOKUP and INDIRECT question

I'm using VLOOKUP to look up a value on another worksheet. The lookup works
fine when I use a constant for the sheet name but I get 'The Formula You
Typed Contains an Error' message when I try to pull the sheet name from a
cell on the current worksheet.

The following works fine
=VLOOKUP(CurrentMonth,'Cost of Goods Sold'!$AE41:AF52,2,FALSE)

Cell A9 on the current worksheet contains the sheet name Cost of Goods Sold.
This formula does not work:
=VLOOKUP(CurrentMonth,"'"&INDIRECT("A9")&"'!"&$AE$ 41:$AF$52,2,FALSE)

Do I have a simple syntax error here or can I not use INDIRECT in this manner?

--
TIA
Chuck M.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,311
Default Need help please with VLOOKUP and INDIRECT question

Try this:

=VLOOKUP(CurrentMonth,INDIRECT("'" & A9 & "'!$AE41:AF52"),2,FALSE)

HTH,
Paul

"Chuck M" wrote in message
...
I'm using VLOOKUP to look up a value on another worksheet. The lookup
works
fine when I use a constant for the sheet name but I get 'The Formula You
Typed Contains an Error' message when I try to pull the sheet name from a
cell on the current worksheet.

The following works fine
=VLOOKUP(CurrentMonth,'Cost of Goods Sold'!$AE41:AF52,2,FALSE)

Cell A9 on the current worksheet contains the sheet name Cost of Goods
Sold.
This formula does not work:
=VLOOKUP(CurrentMonth,"'"&INDIRECT("A9")&"'!"&$AE$ 41:$AF$52,2,FALSE)

Do I have a simple syntax error here or can I not use INDIRECT in this
manner?

--
TIA
Chuck M.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Need help please with VLOOKUP and INDIRECT question

One way:

=VLOOKUP(CurrentMonth,INDIRECT("'"&A9&"'!AE41:AF52 "),2,FALSE)

In article ,
Chuck M wrote:

I'm using VLOOKUP to look up a value on another worksheet. The lookup works
fine when I use a constant for the sheet name but I get 'The Formula You
Typed Contains an Error' message when I try to pull the sheet name from a
cell on the current worksheet.

The following works fine
=VLOOKUP(CurrentMonth,'Cost of Goods Sold'!$AE41:AF52,2,FALSE)

Cell A9 on the current worksheet contains the sheet name Cost of Goods Sold.
This formula does not work:
=VLOOKUP(CurrentMonth,"'"&INDIRECT("A9")&"'!"&$AE$ 41:$AF$52,2,FALSE)

Do I have a simple syntax error here or can I not use INDIRECT in this manner?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default Need help please with VLOOKUP and INDIRECT question

Chuck

The indirect argument needs to evaluate to an address, and it will if
you do your concatenation inside the parentheses. So,

=VLOOKUP(CurrentMonth,"'"&INDIRECT("A9"&"'!"&$AE$4 1:$AF$52),2,FALSE)

should work.

Good luck.

Ken
Norfolk, Va



On Jun 8, 11:10 am, Chuck M wrote:
I'm using VLOOKUP to look up a value on another worksheet. The lookup works
fine when I use a constant for the sheet name but I get 'The Formula You
Typed Contains an Error' message when I try to pull the sheet name from a
cell on the current worksheet.

The following works fine
=VLOOKUP(CurrentMonth,'Cost of Goods Sold'!$AE41:AF52,2,FALSE)

Cell A9 on the current worksheet contains the sheet name Cost of Goods Sold.
This formula does not work:
=VLOOKUP(CurrentMonth,"'"&INDIRECT("A9")&"'!"&$AE$ 41:$AF$52,2,FALSE)

Do I have a simple syntax error here or can I not use INDIRECT in this manner?

--
TIA
Chuck M.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 54
Default Need help please with VLOOKUP and INDIRECT question

Perfect! I was so close, yet so far away :-)

Thanks Paul.
--
Chuck M.


"PCLIVE" wrote:

Try this:

=VLOOKUP(CurrentMonth,INDIRECT("'" & A9 & "'!$AE41:AF52"),2,FALSE)

HTH,
Paul

"Chuck M" wrote in message
...
I'm using VLOOKUP to look up a value on another worksheet. The lookup
works
fine when I use a constant for the sheet name but I get 'The Formula You
Typed Contains an Error' message when I try to pull the sheet name from a
cell on the current worksheet.

The following works fine
=VLOOKUP(CurrentMonth,'Cost of Goods Sold'!$AE41:AF52,2,FALSE)

Cell A9 on the current worksheet contains the sheet name Cost of Goods
Sold.
This formula does not work:
=VLOOKUP(CurrentMonth,"'"&INDIRECT("A9")&"'!"&$AE$ 41:$AF$52,2,FALSE)

Do I have a simple syntax error here or can I not use INDIRECT in this
manner?

--
TIA
Chuck M.




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
INDIRECT Question OdAwG Excel Discussion (Misc queries) 1 May 2nd 07 04:09 AM
INDIRECT Question I think s boak Excel Discussion (Misc queries) 4 May 4th 06 12:14 PM
Question on INDIRECT Peter Bernadyne Excel Discussion (Misc queries) 6 February 28th 06 04:51 PM
indirect.ext question Dave K Excel Discussion (Misc queries) 0 December 14th 05 10:43 PM
INDIRECT.EXT question SU Excel Worksheet Functions 8 April 12th 05 07:57 PM


All times are GMT +1. The time now is 12:14 PM.

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

About Us

"It's about Microsoft Excel"