Solved

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

Posted on 2013-01-29
7
273 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
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.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now