Solved

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

Posted on 2013-01-29
7
276 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
File upload fails with SSL Certificate 3 23
first name and last initial in excel 11 28
php exec doesnt works on iis 4 16
Preserve formatting during mail merge using VBA 18 39
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

809 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