Create hyperlinks based on matching names in a directory - excel

I have a Column of data in excel with employee names, I am trying to hyper link each cell to the Employee file in a directory, the names for the folders and cells are formatted identically. I could manually go through and hyperlink these however that would be very tedious and I am hoping there is a function that can accomplish this that I am not familiar with.
I think this is also doable using macros/vba however that is something I have not used in the past.
Thanks for your time and feedback!

Use the =HYPERLINK function in column B. Assuming that the files are in C:\directory\ and that they are called "content in column A".xlsx -- try this:
=HYPERLINK("C:\directory\"&A1&".xlsx", A1)
Source: Microsoft: HYPERLINK function

Related

Load single cell in query in excel

I have n excel files with the same layout, and i want to create a recap file where some info is reported for each file. The info is located in the same specific cells, for example d2 and e2 in every file.
What is the best way to do it? The file names vary without logic and that people that access that file have no skills in coding and macro, so i try to develop something very simple.
I also have no skill in database, but i have managed to create a query with every file in the folder, i have then created a column with the data but i am not able to say that i only want a specific cell, is there a way to do it?
here is a picture of the situation
A formula using INDIRECT can be used, but it will generate a #REF error when the workbook is closed. you could use your macro to open the relevant workbook, and then close it after saving the values
the indirect formula would look something like this:
=INDIRECT("'[Test File.xlxs]Test Data'!$A$7")
or, as a formula using your data:
=INDIRECT("[" & B1 & "]YourSheet!$E$2")

Referencing a linked file from INDEX() in Excel (Office 365)

I've got a collection of about 40 Excel worksheets. They store information about the number of hours that people have spent working on different projects, with dates across the top row from left to right and project names down the first column. Each member of the team has their own separate worksheet.
I'm making a new worksheet that will add up the number of hours each person has spent on a specific project.
I'm using this formula to add up all the numbers in a particular range of a linked file:
SUM(INDEX('S:\path\to\folder[Username_2017.xlsx]Daily'!G:JG,JOB_ROW,0))
JOB_ROW is the row containing the numbers I want to add up. Columns G:JG cover 1 Jan - 31 Dec. Username_2017.xlsx is different for each of the 40 people.
The problem is that the formula only works if I create it by hand. I can't find any way to use a dynamic reference to the filename, which gets very tedious with 40+ files to reference. I thought this might work:
SUM(INDEX(INDIRECT(C3),JOB_ROW,0))
...where C3, C4, C5 etc. would contain automatically-generated filenames and references. But it doesn't work. I get #REF!. And Excel doesn't prompt me to link the files -- which suggests to me that it will never work this way.
I've also found that even when the spreadsheet is working properly with the manually-entered formulae, if I save it and re-open it then Excel tries to be helpful by stripping out the formulas and replacing them with the text #REF!.
Is it possible to do what I'm trying to do? Or do I need to learn some VBA?
I should point out that I've largely avoided using Excel in my career so far -- so if there's a better way to achieve this then I'd love to hear it.
Thanks in advance for your help.
ian0411 gave the simple answer to this question in the comments above: the answer is "you can't do that".
If he wants to post that then I'll accept it as an answer -- but for the benefit of anyone else reading this question and looking for alternative options, here's what I tried and what worked:
VBA
I wrote some very simple VBA using GetObject() to open and read from each of the workbooks. It worked, but a) it was very slow, and b) it seemed to keep all the files open as long as Excel was running, which caused other problems. It also crashed a lot.
I gave up on VBA.
Automating the filename replacement
The next option I tried was to have a column of filenames in Excel, with a column next to it containing the formula that I wanted to run on each file. Instead of putting the linked filename in the formula, I put a unique placeholder ('XXXXX' or whatever).
Then I made a little macro that (for the currently selected row) did a search and replace across the row to change 'XXXXX' to the filename in column A. I had to run the macro 40 times to cover each file, but I only had to do that process once. When I add a new file to the list, I'll just add a new line, copy the formulas, and update the filename.
I've now got a spreadsheet which works perfectly when the linked files are closed, and which doesn't rely on VBA.
Perhaps if my VBA skills were better I could have written something less flaky -- but doing it all with INDEX() seems like the fastest, most elegant, and most reliable solution.

dynamic changing path in formula in excel

i have a folder with .xls files which are all named like xxx_day_month_year.xls and i want to look up for some values in this files by selected date.
I came to next solution:
=VLOOKUP(B3;INDIRECT("'G:\xxxxxxx..\"&G3&"."&G4&".2014_test.xls]HL'!$C:$D");2;FALSE)
Where cells G3 and G4 are desired day and month.
But this only works if I have opened documents in which I look up for data. Is there a way that this formula is going to work in independent document?
I did a bit of digging on my own, and it looks like the INDIRECT function will not work with a closed workbook. However, you could use VBA to accomplish your task.
Take a look at this previous post which explains a VBA workaround for a similar issue. You may be able to adapt it to your specific situation.

Custom sheet in address

Here's what I want to do...
I have an excel with a bunch of sheets... let's name them A,B,C,D.
And another one where I get values from one of them depending what the user enters in one cell.
So... to get a value from a sheet I use the following formula
='[file.xls]A'!$I$15
What I want to do... is if an user enters value B in a specific cell to have the formula changed to:
='[file.xls]B'!$I$15
Is there any way to do this?
Thanks!
You can only INDIRECTly reference a workbook that is open. If you are not going to open the external reference document, then you will need to install additional functionality into your Excel.
The ADD-IN is called MoreFunc...read all about it here:
http://xcell05.free.fr/morefunc/english/
Download and install it from here:
http://download.cnet.com/Morefunc/30...-10423159.html
Go into TOOLS > ADDINS and activate MoreFunc.
Now you have many, many new functions available to you. Any place you used INDIRECT, now use INDIRECT.EXT instead and it will work on closed workbooks.
Build the address string, and then use INDIRECT to retrieve its value.
e.g: if the sheet sheet name is in A1, then your formula could be something like
=INDIRECT("'[file.xls]" & A1 & "'!$I$15")

How to build a chart in excel, such that the source file containing data can be changed interactively?

I have a directory with many excel files with numeric data. In each file the data is arranged in the same manner (the same column names, etc...). I am interested to build an interactive
chart which will display the data according to the chosen file name.
For example, the file name will be chosen from validation list in a drop down menu fashion.
The question is how to specify the data range in the chart, such that it will change according to the name of the file that I choose.
I work with excel 2010 and don't have much experience with VBA programming :(
Thanks a lot,
Sasha
Well, a simple solution (there may be more elegant ways but that's a first hint):
Copy the data from your files in the Sheets of your workbook, you can create references (see here) or automate copies through macros (just STFW)
Create your validation list (for instance on Sheet1, cell A1). Let's assume this list contains: DataSource1, DataSource2, DataSource3.
Create Named Range for every other Sheet you have and use the same name as the one in your list (DataSource1, DataSource2, DataSource3)
In the chart source of values, use this formula: =INDIRECT(Sheet1!$A$1)
Hence, Excel will translate the source to the Named Range.
You could probably find solutions with vba too depending on your needs.
Regards,

Resources