Insert filename into directory link from cell value - excel

I've got a list of 150 filenames in column A e.g. WorkBook1-WorkBook150 and want to reference this when including the file directory so I will be able to reference a cell out of the workbook. The cell is an outstanding amount for a particular supplier so I wish to create a workbook to have a full overview of the outstanding amount and broken down for each supplier in a list.
A1 filename: File1.xls
So if filename 1 is in A1, is there a way to action this so we can pull the filename from A1 and insert it in the relevant place in the directory? It works if I input the text from A1 manually but referencing the cell into the relevant place would save a lot of time.
Example of what I wish to input in B1: ='C:\Directory\FolderName[A1]Sheet1'!$D$4
Thank you for your time!

If I understand your question correctly, what you need is the 'CONCATENATE' formula. A1 contains 'filename.xls'. In B1 you can put: 'C:\Directory\FolderName\'
In C1 you can then put
=CONCATENATE(B1;A1)
which gives you
C:\Directory\FolderName\filename.xls

If you are trying to make it where you choose from a list you would need to use the data validation button and make a list. Make sure you have the reference in another cell.
Then you can use concatenate with the drop-down cell for efficiency.

Related

Multiple Cell Vlookup Searches

I trying to make this formula flexible so I can search the value in a cell in multiple file paths and different excel files to give me a result.
My data in each excel fiel is in the same table for each workbook.
=VLOOKUP(A6,IndirectEx("'C:\_Excel\ExcelExamples\VLOOKUP_External_Sample\[Workbookname.xlsx]Master'!MatlDB"),1,0)
Can you guys help.
Thanks-
Based on your comment that the file paths are stored in a table, and assuming that these are on a sheet named "Locations":
=VLOOKUP(A6,INDIRECT(Locations!A1&Locations!B1),1,0)
This should work, but the cell references are hardcoded. Not sure how you want to select the references.
I answered my own question. So after some trial and error my result, and if someone can find a better way or help me create a macro, that would be awesome.
="vlookup(A1,"&"'"&""&A2&"\"&"["&A3&"]"&"SampleTab'!$G$62:$DU$175,A4,0)"
So what I had to do is write it as I was creating a text. Copied it into a different cell and remove the quotations from the formula.
Then move the range P114 , C117 , C122 & Q113
A1 would be the lookup value cell.
A2 would be the file path cell.
A3 would be the workbook name (note it has to include the file extension)
The range (SampleTab'!$G$62:$DU$175) has to be hard coded for now. A4 would be the row where the data is at.

excel - hide formula for easier input

I have a cell formula that's working mixing both text and an If statement, example: ="USER_INPUT" & IF(F2="Asia/Singapore","+08:00","+02:00") output: USER_INPUT+8:00
I'm not the one that will use this formula so I'd like to avoid having the user to search for the "USER_INPUT" in the whole formula in order to prevent mistakes.
Is it possible for the user just to type whatever he want in the cell wihout having the whole formula behind?
example of cell input I want:
="USER_INPUT" & formula
Is there any reason why the cell containing this formula cannot be in another location which the user does not need to edit? So I am suggesting that you have a highlighted cell somewhere for user input (say G2 for the sake of argument), and then in another cell you have the following formula:
=G2 & IF(F2="Asia/Singapore","+08:00","+02:00")
Your display cell can then refer to the cell containing the above formula. You could even take things a step further and lock the cells which contain the actual formulas, to make sure your users don't accidentally change them. Follow the link below for information on how to do that.
https://support.microsoft.com/en-sg/help/214081/xl-how-to-lock-individual-cells-in-a-worksheet

Importing data from a different spreadsheet

I'm familiar with using the following to pull data in from another spreadsheet....
=[filename.xlsm]Sheet!A1
My question is, can I specify the filename in a cell (like AI) then use that cell reference in order to pull that data in...
A1 = filename.xlsm
Then the corresponding cell formula would be
=[AI]Sheet!A1
Such that if I changed the name of the file in cell A1 I would change the reference and pull data from another source? The above is just an example, it doesn't work so my question is can this be done and if so, how?
** The file that I am pulling data from may not be open at the same time **
Many thanks.
Yep! Using Indirect() you can:
If A1 has a filename, in B1 you can put:
=Indirect("'["&A1&"]Sheet1'!A1")
Note: With Indirect(), your workbook that you're referring to has to be open, otherwise you'll see an #REF error.

Is it possible to stop cell value link from one tab to another tab?

After searching for quite a while, I can't find the answer to this question, so if it's solvable, please feel free to answer :)
In the worksheet, I have two tabs: tab_A, tab_B.
tab_A has a list of data: A1, A2, A3, ...., etc.
tab_B is a copy of tab_A, through formula, so simply the cell value in tab_B is "=tab_A!A1", "=tab_A!A2", "=tab_A!A3", ... etc.
Now, here is the problem, if I want to add a data into the list in tab_A at location "A2", then what I do is that I add a new row after "A1", and type in the new "A2" value in the place where old "A2" was.
I expect the value in the tab_B at the location "=tab_A!A2" automatically changes to the new value that I just put in tab_A. But, instead, the value in that cell in tab_B changed to "=tab_A!A3".
Is there a way to link the cell values in two tabs that tab_B cell values stick to the cell values in tab_A at the location that I set?
Appreciate all the help!
Thanks!
You can use the INDIRECT function. In a scheme like that:
in the cell C1 you add:
=INDIRECT("A"&ROW(F1))
And autocomplete. The reference F1 it's to have a number that increase... Whit this code you can Insert and delete what you want and the second Table remain in Sync. If the second tab in in another table you add the reference before "A".

Use Cell Value as reference for VLOOKUP table array?

I would like to be able to allow a user to change the file being used as a reference in a VLOOKUP. All the files being used will have the same array, just different files paths.
This is how i think it should operate.
Click macro button that opens file browser.
Allow user to choose file.
Paste file path in cell (A1)
Convert path to include array.
In VLOOKUP formula, reference the cell A1 as the 'table array'.
I am already able to complete up to step 3. Any idea on how to add the defined array and reference the cell in a VLOOKUP?
I would just record doing exactly what you want to do and then replace what you did with a variable that gets assigned, like when you place the path into cell A1. Then just have the macro re-write the appropriate vlookup formula.
You could also make a formula that would show what you want, and then use vba to copy that and paste values. You may then need to find and replace something in the cell(s) to get it to actually convert to a formula.
Example:
In A1 Put the path (with workbook name, i.e.C:\Users\username\Desktop\Book3.xlsx )
In B1 ="=VLOOKUP(D1,'"&MID(A5,1,FIND("*",SUBSTITUTE(A5,"\","*",LEN(A5)-LEN(SUBSTITUTE(A5,"\","")))))&"["&MID(A5,FIND("*",SUBSTITUTE(A5,"\","*",LEN(A5)-LEN(SUBSTITUTE(A5,"\",""))))+1,100)&"]Sheet1'!B$1:C$4,2,FALSE)"
B1 then looks like this =VLOOKUP(D1,'C:\Users\username\Desktop\[Book3.xlsx]Sheet1'!B$1:C$4,2,FALSE)
Copy B1 to C1 and do a find replace of something, like find Users and replace all with Users.
This is messy, but I use something like this for a tool that needs to update form 30 different files of different sizes based on 6000 rows of array formulas that update of yet another spreadsheet. It works well for me, but a bit slow for large files.

Resources