Excel - Read Files Depending On Variable

J

Justin_Wolfe

Ok, my company is wanting me to create a file to compare our curren
cummulative year to the previous cummulative year.

Currently we are in Quarter 3 of year 2004, so we would want ou
Current Cummulative year to be: Quarter 3, 2, and 1 of 2004, an
Quarter 4 of 2003.

Our Previous Cummulative Year that it will compare to would be Quarte
3, 2, 1 of 2003, and Quarter 4 of 2002.

So, here is where I am running into problems. We track each year in
seperate excel workbook, and it is impossible to track all years in on
cummulative workbook due to the inevitable massive file size, so w
have to read a different workbook "depending on what year and quarte
of that year" it currently is.

For example, lets say that we have three files. "2002.xls, 2003.xls
and 2004.xls". And if we are using the quarters/years I mentione
above, we would be reading like this:

=[2004.xls]Sheet1!$E$30:$E$33 (This is quarter 3)

But! 2004.xls, needs to be able to be replaced by the variabl
"current_year" so that next year it will automatically read from 200
when I change "current_year" to prevent us from having to do thi
project every year.

Would this require a VBA script, or is it possible through built-i
excel functions? I begin to get lost when creating VBA scripts.. an
would appreciate it greatly if someone could assist me if it comes dow
to needing one.

I have included a small (36k) bmp screen shot of the spreadsheet I
designing.. though it is only a rough look, it is the basic meat o
what the real spreadsheet is going to provide. (Sorry about the colo
loss, I had to monochrome it to make it fit the file siz
requirements.)

If you need any information I might have forgotten, please contact m
through email at (e-mail address removed)

Any and all help will be greatly appreciated,
- Justi

Attachment filename: view.bmp
Download attachment: http://www.excelforum.com/attachment.php?postid=61776
 
J

Juan Sanchez

Justin

You could use Indirect, like this:

=INDIRECT("'C:\["&TEXT(TODAY(),"YYYY")&".XLS]Sheet1!
$E$30:$E$33")

Unfortunatelly, INDIRECT only works with a book that is
open, if having the current year's book open is a problem,
you can download the Add-Inn "More-Funcs" from here:

http://longre.free.fr/english/

this add-inn has a function named INDIRECT.EXT that allow
you to get data form a closed book, and you would use it
like this:

=INDIRECT.EXT("'C:\["&TEXT(TODAY(),"YYYY")&".XLS]Sheet1!
$E$30:$E$33")

you need the full path!, replace c:\ in either formula
with the complete workbook path...

hope this helps...

cheers
Juan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top