Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Ron is offline
external usenet poster
 
Posts: 250
Default How can dynamically set a range name in a HLOOKUP command?

I'm working on a project the projects out 13 weeks AND reports historically
13 weeks back. Data and reporting is done annually. Hence, once I get into
November I need to reference a named in range in the "2008" file instead of
the a named range in the current file.

I've tried "concatenate", which addes double quotes. The only solution I
have is that each year you need to "hard-code change" the formulas.

Ex: Hlookup(F2,'2007 forecast'.xls,85,false) I'd like "2007" to
dynamically change to 'current year + 1' (ie"2008") if Year(current date) <
year(forecast date).
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default How can dynamically set a range name in a HLOOKUP command?

You can use the INDIRECT function to build a string with the correct year.
INDIRECT translates a text string to a real cell reference.

=HLOOKUP(F2,INDIRECT(IF(MONTH(NOW())=11, YEAR(NOW()),YEAR(NOW())+1)& "
forecast.xls"),85, FALSE)




"Ron" wrote in message
...
I'm working on a project the projects out 13 weeks AND reports
historically
13 weeks back. Data and reporting is done annually. Hence, once I get
into
November I need to reference a named in range in the "2008" file instead
of
the a named range in the current file.

I've tried "concatenate", which addes double quotes. The only solution I
have is that each year you need to "hard-code change" the formulas.

Ex: Hlookup(F2,'2007 forecast'.xls,85,false) I'd like "2007" to
dynamically change to 'current year + 1' (ie"2008") if Year(current date)
<
year(forecast date).


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
Dynamically create range of rows Avi Dubnikov Excel Discussion (Misc queries) 2 August 25th 07 02:00 AM
Setting Range Dynamically DJS Excel Discussion (Misc queries) 5 December 7th 06 09:51 PM
Dynamically Changing HLOOKUP table PatK Excel Worksheet Functions 4 September 29th 06 03:51 AM
Dynamically set a range? BKGT Excel Worksheet Functions 3 April 27th 06 03:26 PM
How to use HLOOKUP or other command to find a value within a range antwash Excel Worksheet Functions 4 January 8th 06 04:08 PM


All times are GMT +1. The time now is 05:10 AM.

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"