How to hyperlink all pdf files present in a subfolder to excel? - excel

I am trying to hyperlink all the fields in column B (picture given below) to the respective content in the folder (picture also provided).
I realized its stupid for me to do it manually and it takes a very long time to do so.
Is there a better way to link them automatically or with more ease?.
I realize that I can do it with help of VBA but I have no clue how to do it.
This is how my excel column B looks before hyperlinking:
So this is what I get after manually adding the hyperlinks to
column B.
This is the folder(folder name is 2016) which has subfolders (the one in image) and in each of these
subfolders there is a pdf file and a word file.
I am required to hyperlink the contents in column b (which are not already hyperlinked to the pdf files to their respective subfolders in this folder "2016" (You can see the address bar).
Here are the pdf and word files inside the subfolders of "2016".
So basically you see is that in column B the numbers in the end are in series. I want them hyperlinked to the pdf files inside these subfolders.
If you observe closely , the subfolder have a huge name (including the parenthesis content) , whereas my column B has name of the sub folder excluding the parenthesis part.
So basically its like matching the serial numbers and hyperlinking the pdf file inside the subfolders.
EDIT:
I tried the following by using =HYPERLINK("\\qatargas.com.qa\doc\Admin\Al_Khor_Community\Alwaha_Club_Admin_Office\Comments & Suggestion Response\2017\"&B1512&" ("&C1512&" "&D1512&")\"&B1512&" ("&C1512&E1510" "&D1512&")"&".pdf";B1512) on cell e1512.
I get this error

Insert a new column "C" (or wherever) and enter in (for example) cell C1210:
=HYPERLINK("file://C:\your_base_path\" & B1210 & "\name_of_pdf_file.pdf","Click to view PDF")

For example in the row 1512: you want to have a hyperlink to a pdf (what is the concrete name of this pdf?) in a path "[...]\qatargas.com.qa\doc\Admin[...]\2016\AKC-CS-17-0124 (QG 3739)". Right?
Then write in cell e1512 the following formula (if the name of pdf is always the same):
=HYPERLINK("[...]\qatargas.com.qa\doc\Admin\[...]\2016\"&B1512&" ("&C1512&" "&D1512&")\"&"<nameofyourpdf>";B1512)
You have to use your path (i used [...] to drop part of the path) and you have to use the name of your pdf, which is always the same you said.
or if name of the pdf is like the Name of the folder:
=HYPERLINK("[...]\qatargas.com.qa\doc\Admin\[...]\2016\"&B1512&" ("&C1512&" "&D1512&")\"&B1512&" ("&C1512&" "&D1512&")"&".pdf";B1512)

Related

hyperlinks to PDF files

I have an Excel spreadsheet in which I need to make hundreds of links to PDF files that are in the same folder on my computer.
The file name for the link appears in the Excel table.
Today I create each link separately, but I'm sure there is a simpler way to tell Excel to copy the link in the top box but look for the file whose name appears in the Excel table.
I'm doing each hyperlink separably
Assuming A1 has the name of the hyperlink and A2 has the location, use this formula where you want the link to appear:
=HYPERLINK(A1,A2)
You can then copy this down to the other cells.

EXCEL maintain hyperlink with the cell content after sorting/ using formula

INTRODUCTION
I have made a excel sheet of file index. Each file entry is linked with scanned copy of the file. So when i click the file name in excel sheet the linked PDF file opens.
ACTIVITY
In a separate worksheet i have made a search function based on multiple search results with partial matching. So when i enter part of either file name or subject i get the file name using
" =IF($F$1="","",IFERROR(INDEX(A$2:A$8,SMALL(IF(ISNUMBER(SEARCH($F$1,B$2:B$8)),ROW(B$2:B$8)-ROW(B$2)+1),ROWS(B$2:B2))),""))
"
PROBLEM
The file name obtained is plain text without the hyperlink associated with the file name in the master database.
WHAT HAS BEEN TRIED
I have tried using
(A) =IFERROR(HYPERLINK(.....))
(B) =HYPERLINK(CELL NUMBER)(By getting the row number from formula and using index function to reference the cell)
There is a tiny trick:
Insure the hyperlinks in the source column are formatted so that the "display name" is the URL. You can use either Inserted hyperlinks or the =HYPERLINK() worksheet function.
Say we have links in column A and we want an alphbetized list in column C. In B1 enter:
=LOOKUP(1,0/FREQUENCY(ROWS($1:1),COUNTIF($A$1:$A$3,"<="&$A$1:$A$3)),$A$1:$A$3)
and copy downward. (Column B is in alphabetic order, but the links are "cold") Then in C1 enter:
=HYPERLINK(B1,B1)
Even though the links in column B are "cold", the links in column C are "hot"

Create a link to a Word document from an Excel cell using a relative path

In an Excel cell, I want to link to a MS Word file, e.g. to C:\MyFile\someDoc.docx, using a relative path.
My Excel file is in the folder C:\MyFile. So my path should be something like currentdirectory\someDoc.docx so that I can mail the whole C:\MyFile folder or transfer it somewhere else.
How can I do that?
I am aware how to link with an absolute path like C:\MyFile\someDoc.docx but what if I transfer the Excel file to somebody. In the destination folder, will it still search for the C:\MyFile location?
You can get the location of your workbook using the CELL function.
Enter the below formula in your sheet, say in cell B1,
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)
This will give you the root folder in which your workbook is present. Now in the cell in which you have the link to the docx file, use the below formula,
=HYPERLINK(B1&"someDoc.docx","Click here")
Hope this helps. Even if you move the folder, this will work.

Reference Excel files getting filename from a cell

I want to get values from different excel files (say, File-AAA.xlsx, File-ABC.xlsx, etc). ¿How can I reference said files without inputting manually the "ABC" part of the filename, but getting it from the current sheet instead?
In the example, from our current sheet we want to get the values of A1 and A2, from the File-ABC.xlsx file, and sum them.
For instance, in B2, instead of writing:
=SUM('\\server\path\[File-ABC.xlsx]Data'!A1:A2)
I would like to be able to write it as
=SUM('\\server\path\[File-*REFERENCE TO CELL*.xlsx]Data'!A1:A2)
Where *REFERENCE TO CELL* is the sought text string that references the cell that contains "ABC" (A2).
You can use the indirect function for this.
Something like this -
=SUM(INDIRECT("'\\server\path\[File-"&A2&".xlsx]Data'!A1"&":"&"A2"))
Edit-1 :
You can use the same syntax to refer to the local directory that you want, just replace \server\path[File- with the path of the new directory. You can copy the path from your file explorer after browsing to the concerned folder.
Eg. Taking the path from your comment (after correction):
=SUM(INDIRECT("'C:\Users\PeteThePanda\Spreadsheets[File-"&A3&".xlsx]Data'!A1"&‌​":"&"A2"))
A more straightforward way to do this is set up a conditional statement outside the sum, e.g. if the value of A2 in the current workbook is ABC, then go to this path and bring in the sum.
e.g.
=if(A2="ABC",sum('\\server\path\[File-ABC.xlsx]Data'!A1:A2),if(A2="AAA", sum('\\server\path\[File-AAA.xlsx]Data'!A1:A2),"No File"))
Note, you can add additional nested IFs if there are more files. Just start a new if where I wrote "No File".

Bookmark Special Paste, Excel look in same folder

I have a word doc and an excel doc, I have created bookmarks in word and special pasted into excel.....These bookmarks works AS LONG as the files stay in the ORIGINAL location (example- C:\Documents and Settings\My Documents\New Form)
BUT
I need to move the documents to different client locations (example- C:\Documents and Settings\My Documents\client1)
In excel the cell information reads like this;
=Word.Document.8|'C:\Documents and Settings\My Documents\NewForm\TestFactFind.doc'!'!Title'
Is there anything I can put so the excel file will look into its current folder to find the word document instead of a set location?
NON VBA Method
Yes it is possible for the Excel formula to pick up the value from a file from the same directory where the formula containing files reside. You have to use INDIRECT(). However a word of caution. INDIRECT will work only if the destination workbook is open.
Here is an example
Let's say the formula in Cell B1 in C:\Book1.xlsx is
='C:\Sample\[Sample.xls]Sheet1'!$A$1
Then put this formula in Cell C1 for testing it
=INDIRECT("'" & LEFT(CELL("filename",A1),FIND("[",CELL("filename",$A$1))-1)&"[Sample.xls]Sheet1'!$A$1")
Screenshot
I dont know about Word bookmarks, but I assume they are the same as Excel hyperlinks (?)
This may or may not be relevant in Word, but in excel you can create a link to any other document using the hyperlink formula. If you use the current directory (folder) as the root, it will go from there.
".\" is the current folder
"..\" is the parent folder that the current folder is in
So lets say you have an excel sheet with links to 20 Word documents stored in a subfolder called REPORTS (excel to word being the reverse of what you proposed, but it is probably the same the other way around?).
The links in each excel cell would be:
=HYPERLINK(".\REPORTS\JAN.DOC","January report")
=HYPERLINK(".\REPORTS\FEB.DOC","February report")
=HYPERLINK(".\REPORTS\MAR.DOC","March report")
etc...
A feature I use often is to have the filenames, or part of the filenames, listed in an excel column parellel to the links, and use that cell in the hyperlink filename. Take the following example, and assume it to be range A1:B4 (Line 1 being the column headers "month number" and "link to report").
In this example, I named my word documents MONTHxx.DOC, xx being the month number.
MONTH NUMBER LINK TO REPORT
01 =HYPERLINK(".\REPORTS\MONTH" & A2 & ".DOC","Report for month " & A2)
02 =HYPERLINK(".\REPORTS\MONTH" & A3 & ".DOC","Report for month " & A3)
03 =HYPERLINK(".\REPORTS\MONTH" & A4 & ".DOC","Report for month " & A4)
etc
Having the cell at the end in the second part of the hyperlink puts the month number also in the name of the link for the user to see. You can, of course, use any cell there to put a name.
The beauty of this method is that if you have, say, a list of 500 files to link to, and they are all numbered in sequence (like the example), you can just copy-paste the first hyperlink all the way down the column which will instantly give you 500 links to other documents.
Just FYI, the documents do not need to be open already. Clicking the link will open the linked document.
I know this is not what you asked about, but it is fairly close. Hope it helped.

Resources