Solved

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

Posted on 2013-01-29
7
272 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

23 Experts available now in Live!

Get 1:1 Help Now