Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Lookup where target worksheet may vary

I have a formula, similar to one below, that I want to use in many workbooks:

=HLOOKUP(TCI_TestCycle,[TestGroups.xls]REGR!Group,5,FALSE)

The worksheet REGR however will change. Sometimes it will have other values
depending on the workbook in which the formula is used. These worksheets are
in a separate workbook.

How, instead of the string REGR, can I insert a value from another cell in
the workbook?

Thanks,
--
Nigel Barton
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Lookup where target worksheet may vary

If A1 contained "REGR" or another sheetname:

=HLOOKUP(TCI_TestCycle,INDIRECT("[TestGroups.xls]" & A1 & "!Group"),5,FALSE)

"Nigel Barton" wrote:

I have a formula, similar to one below, that I want to use in many workbooks:

=HLOOKUP(TCI_TestCycle,[TestGroups.xls]REGR!Group,5,FALSE)

The worksheet REGR however will change. Sometimes it will have other values
depending on the workbook in which the formula is used. These worksheets are
in a separate workbook.

How, instead of the string REGR, can I insert a value from another cell in
the workbook?

Thanks,
--
Nigel Barton

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Lookup where target worksheet may vary

Sometimes you'll need to surround the workbook/worksheet name with apostrophes:

=HLOOKUP(TCI_TestCycle,indirect("'[TestGroups.xls]" & a1 & "'!Group"),5,FALSE)

And =indirect() will only work if the sending workbook is open.

Saved from a previous post.

The function you'd want to use that's built into excel is =indirect(). But that
function returns an error if the sending workbook is closed.

If that's a problem, then Laurent Longre has an addin (morefunc.xll) at:
http://xcell05.free.fr/
or
http://xcell05.free.fr/morefunc/english/index.htm

That includes =indirect.ext() that may help you.


Nigel Barton wrote:

I have a formula, similar to one below, that I want to use in many workbooks:

=HLOOKUP(TCI_TestCycle,[TestGroups.xls]REGR!Group,5,FALSE)

The worksheet REGR however will change. Sometimes it will have other values
depending on the workbook in which the formula is used. These worksheets are
in a separate workbook.

How, instead of the string REGR, can I insert a value from another cell in
the workbook?

Thanks,
--
Nigel Barton


--

Dave Peterson
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
lookup source can vary -- how to code? SLP Excel Programming 4 August 1st 07 01:00 PM
Editing the target worksheet zhj23 Excel Discussion (Misc queries) 3 June 27th 07 12:33 PM
formula to lookup value and return value from cell at left of target Tony Strazzeri Excel Worksheet Functions 14 October 3rd 06 08:30 AM
Vary column width and row height in the same worksheet Tess Excel Discussion (Misc queries) 1 August 4th 05 03:39 PM
Trapping Worksheet Target Chuck Taylor Excel Programming 5 January 22nd 04 03:29 PM


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