Solved

How do I alter a link in excel depending upon a cell value

Posted on 2013-01-29
7
277 Views
Last Modified: 2013-02-04
Hi,

I have a link that works fine:
='K:\Accounts\[1.xls]Sheet1'!F74

but I now want to change the referenced workbook based on a cell value...

I have tried:
='K:\Accounts\["&A1&".xls]Sheet1'!F74
but this returns #REF where A1 =1

Can you please advise? I am using Excel 2010

Many Thanks
0
Comment
Question by:martinibbo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 13

Assisted Solution

by:Shanan212
Shanan212 earned 100 total points
ID: 38832344
Your file 1.xls has to be open when you try this

try this

=indirect("'K:\Accounts\["&A1&".xls]Sheet1'!F74")
0
 

Author Comment

by:martinibbo
ID: 38832355
The file must be closed as I have many links....

Can we encorporate the index function somehow??

Thanks
0
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 400 total points
ID: 38832404
You might like to try the indirect.ext() function which works on closed files also. You would, however have to download and install the morefunc.xla addin for this
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

by:martinibbo
ID: 38834488
Briefly doing some research into morefunc.xla, there appears to be some compatability issues with Excel 2010 (upto 2007 supported) and some people experiencing the program to crash.

As multiple computers would be accessing this workbook - would I need to install the addin onto each computer?

Also can you recommend a "safe" website to download the addin from?

The link to:  http://www.get-digital-help.com/2010/05/12/extracting-unique-distinct-text-values-from-a-closed-workbook-in-excel-formula/ provides an interesting result close to what I want. Can this be adapted to suit my formula?

Many Thanks
0
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 400 total points
ID: 38834909
I have not tried this but this web page shows that the addin has to be installed on 2010 in a manner different from the way it is done on prior versions

http://www.ashishmathur.com/tag/indirect-ext/

See if it works for you.

As far as the link you provided is concerned the file reference is hardcoded in the formula and cannot be variable so cannot use that.
0
 

Accepted Solution

by:
martinibbo earned 0 total points
ID: 38835540
Thank you all for the quick responses - although I am sure that the excel addin would work, I have many PC's accessing the program and there would need to be over 1000 links. The statement on your last link:  "Since data is being extracted from closed Excel files via an addin, performance of the workbook will take a hit.  Please try this on limited Excel files first." therefore concerned me greatly.

If the scale of my program was smaller then I would of course try it, or if the linked excel workbook could be open at the same time the indirect formula would work - so thank you.

Instead I have chosen to go with a very simple VBA code to generate the links, similar to this:

a = ActiveCell.Value 'where "a" referenced a workbooks name (e.g.1-100)
ActiveCell.Offset(0,1).FormulaR1C1 = "='K:\Accounts\[" & a & ".xlsx]Sheet1'!R1C1"
'then loop through relevant "a" list of workbooks
 
Thanks again!
0
 

Author Closing Comment

by:martinibbo
ID: 38850432
Most suitable, without installing addins and without compromising performance
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question