Load single cell in query in excel - 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")

Related

Excel, use file path to reference cell values in another workbook

I have a series of daily spreadsheets which are file by:
year / month / date
e.g.
/Users/myles/Dropbox (Green)/05_GM Vessels/Crew Dropbox/Green Isle/02_Daily Logs/2019 Logs/[GI_Daily_Log_30.07.2019.xlsx]Sheet1'!$B$44
I would like to use a formula to extract the value within the specified cell (B44 in this case) and show it in a master / summary spreadsheet.
The files are in a different directory to the master / summary spreadsheet.
I have a formula which generates the above file path based on values in other cells. E.G. ="["&$D$14&$W5&"/"&$A5&"]Sheet1'!$C$24"
Which creates the following text within a cell;
[/Users/mylesmetson/Dropbox (Green Marine)/05_GM Vessels/Crew Dropbox/Green Isle/02_Daily Logs/2019 Logs/7_July/[GI_Daily_Log_29.07.2019.xlsm]Sheet1'!$C$24
Ideally I would like to remove the first / and then insert " =' " which if pasted as text into a cell, would then extract the value from this spreadsheet file and the referenced cell. But this does not work. instead I am having to do this manually in notepad and then copy & paste the entire text back into the cell.
Finally prior to excel retrieving the number in the referenced cell, I have to give permission / find the file location.
This is quite a complicated thing to explain and I have not found any other solutions on the internet which are 100% relevant to this scenario. I think a macro may be required, but hopefully this can be done elsewise.
The indirect macro, would be ideal, apart from it requires the spreadsheets to be open, which is simply not practical either.
Thanks
for any help which can be provided.
Myles

Excel - Change source of chart data depending on text in cell

I have one excel file in which I have multiple sheets with financial statements from different companies (called Databas.xlsx). The structures of these sheets are identical. Then I have another excel file that I wish to use to analyse these financial statements using charts. Thus, I must get data from the different sheets into my analysis file. Doing this from one sheet is no problem, as I can simply create a chart and mark the data I need from this sheet, so that the chart data range would be something like this:
=[Databas.xlsx]Kopparbergs!$C$3:$K$3
where "Kopparbergs" is the sheet name in Databas.xlsx. The problem I am facing is that I want to be able to change the sheet name that is put into this formula by writing the name in a cell (because that would enable me to change multiple charts at once). So just to clarify, in the formula written above, I want to be able to change the word "Kopparbergs" by writing text in a cell. If that is not possible, how would I accomplish this? That is, how do you create a chart that can change its content depending on a text in a cell that corresponds to a sheet?
So rather than using Indirect I think you need to use two named ranges for referencing when using a Chart.
This previous answer looks like a good guide to implement (not sure about etiquette of just copy & pasting previous answers so I'll just provide the link):
Dynamic chart range using INDIRECT: That function is not valid (despite range highlighted)

Downloading File with importrange function failing - think it's a bug

I've been saving Google Sheets to Excel without any problems for a while. These sheets have always successfully saved and opened in Excel with the importrange function. However, recently it hasn't been successfully saving correctly.
It used to just have the static value (e.g, 40). There used to be an IFERROR in the first cell in the header row but now it exists in every single cell.
E.g, each cell would have something like this:
=IFERROR(__xludf.DUMMYFUNCTION(importrange(blahblah)),"40").
DUMMYFUNCTION throws an error and "40" is returned as a result. but "40" is a string, not an integer which messes up all my formulas.
I also know this isn't an Excel issue because OpenOffice is doing the same thing with the file.
I'm pretty sure this would be a bug because why would it be working for months and then suddenly stop working?
What should I do?
I'm thinking it's a bug too.
Workarounds
On Excel
Copy and paste as values only the ranges with IFERROR(__xludf.DUMMYFUNCTION(..., then use Excel's UI tools to convert numbers shown as text to numbers.
Selectively remove quotes on the IFERROR second argument of the cells causing problems
Remove =IFERROR(__xludf.DUMMYFUNCTION(),"value") except value (we could use Excel's built-in FIND & REPLACE for this)
On Google Sheets
Use Copy > Paste as values only on the range areas having formulas with non-compatible functions like IMPORTRANGE, QUERY, FILTER, etc.
If you only need the values, download it as CSV instead of XLSX
IMPORTANT
In order to help to prioritize this issue, send feedback to Google. To do this open a Google Sheets spreadsheet, click on Help > Report a problem, then fill the feedback form and submit it.
Related stuff
I posted 5 small articles about this in Spanish. You could find them listed on https://www.rubenrivera.mx/p/descargar-hcg-excel.html.
We accidentally created a workaround for this bug with a different sheet that was just set up like this.
This works when you IMPORTRANGE into another Google Sheet. We are doing it into a Google Sheet with a single worksheet - haven't tried it with multiple.
It's going to sound a little nuts but it works for us.
In the first cell of your import range put a hyperlink in the original document you are importing from. This is in the first cell of the import range. We linked it to a worksheet in the original document. It has worked and failed with an external link. With an external link it worked when I linked it to an internal link, then changed it. But when I deleted the cell and just straight linked it to an external URL it didn't work.
Then #timbo was right - put data validation in. This can be in part of the document that isn't being imported into the second sheet. I put it in the first line of the import range but outside what I was importing. It might have to be the first line. I just put a date in one cell, then in the next cell data > data validation > then choose that one date as the data range.
For aesthetics I have hidden the first row in one Google Sheet I am importing into. In another I made the first cell link the title of the sheet and put the data validation outside the import range. Both of these work.
Let me know if this works for you.
Until this bug is fixed, a workaround is to put a data validation (Data > Data Validation) on the imported data (Any kind of data validation will do).

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.

Copy a column of formulas to a closed workbook in Excel

I have a lot of data into Excel files.
There are about 174 files. Each is named Book2.xslx through Book174.xlsx
I have a master document where I have a column of formulas that I would like to paste (or insert) into each of these spreadsheets without having to actually open each one individually.
Does someone know any code I can use to do this?
As an example, I would say I would want to copy the range P:P - the whole of column P - and insert it or paste it into Column P in the closed workbooks.
Can this be done? If it works , and I want to insert different ranges and cells every time I wanted something different inserted or pasted? Or is there a macro for example, that I could run , that would copy what I've selected to the same place in every unopened spreadsheet named Book*.xlsx?
You cannot do this on existing files without opening them (whether in Excel, or using FSO, as the Object Model won't be available to apply to those files
having said that, it is possible to automate the modifications using VBA.
If you would post your code, we can help you improve it or resolve any issues with bugs or performance

Resources