I have to aggregate data from multiple excel files into one. In my aggregate file, I have created a column with the names of the files from which I want to collect the data. In each respective row, I have to compile values from specific cells of the "origin" file. How can I construct my formulas?
Example:
I have a file AGGREGATE.xlsx, in which column A reads AL, AND etc.
in cell B3, I have to insert the value of cell C11 from the file AL.xlsx
in cell B4, I have to insert the value of cell C11 from the file AND.xlsx
and so on.
Is there a way to construct my formula as
=[filename.xlsx]!Sheet1!C11
but where the "filename" is variable and refers to the cells in my aggregate workbook instead of specifying "fixed" file names? So that I don't have to change the formula for each line and can just copy/paste for the whole table.
Sorry I tried to attach an image to make it more clear but I'm a newbie here and don't have the necessary "reputation" points.
Thanks!
If you are trying to read the filename from cell A3, then this would go in cell B3:
=INDIRECT(CONCATENATE("[",A3,".xlsx]Sheet1!C11"))
Basically, you are building a string using the value in column A, then using the INDIRECT formula to reference the value of the indicated cell. The only problem is the workbooks need to be open for this formula to work. You can read about the technique here.
Related
I need to write a "master" program to read from all (around 30) other excel sheets every single month.
See what I'm talking about
So basically I have a formula as text in one cell called "joined". What should I write in another cell to treat that "joined" cell as formula, that in that new cell it'll execute code and get a cell D3 from other sheet?
You are looking for INDIRECT, something like =INDIRECT(B8) (if I'm interpreting the picture correctly) will get the value in cell D3 in the file and path listed.
But note that these sheets must be open for the function to work. To access "closed" sheets you will need VBA.
I'm using the INDIRECT formula to extract data from specific cells in hundreds of different sheets. In column B, I've listed all of the cells I need data from, and the worksheet names are in row 6. Any suggestions on how to exract the cell number from column B?
I've tried using text strings and the CONCATENATE function, but because of the quotations, I'm getting a reference error.
=INDIRECT("'"&$C$6&"'!M8")
I want to pull data from cell M8 in every sheet, but "M8" is listed in cell B2.
Try:
=INDIRECT("'"&$C$6&"'!"&B2)
You have to use the Value in cell B2.
I thought this would be easy, but haven't figured it out on my own or found an existing answer online.
I have a worksheet set up to create charts from the contents of certain cells in a table. I'd like to be able to point one cell to a value in another worksheet and have all the related cell populate with the values using the formula in the one cell as an address reference.
For example, if I put the formula ='Source Data'!G19 in cell E3, I would like cell E4 below it to act like it has the formula ='Source Data'!G20 (one row below in the Source Data worksheet) and populate that value while cell F3 to the right would act like it had the formula ='Source Data'!H20 in it. So the new worksheet would just mirror the table of data from the Source Data worksheet for as many columns or rows as I need.
I'd tried to figure this out with offset, indirect, match and address functions, but have failed.
It is important to note that the formula needs to be able to identify the actual cell address, not just match the value from the formula because the same values show up multiple times in the Source Data worksheet.
Any help or direction is greatly appreciated.
Here's my approach:
I have a workbook with 2 spreadsheets Source Data and Results, on Source Data, I have the "Static" table that contains all my values from A1 to D12(This can be any number of cells, as long as you use an equal range in the Results sheet).
On Results, Cell A1 is reserved for the "guide" cell from Source Data, written in the following format: ''Source Data'!A1 (note the two single quotes at the begging). I chose to start at Cell B2 on the Results sheet, you can switch the formula however you like.
The desired result is achieved by using the following formula on B2:
=IF(CELL("contents",OFFSET(INDIRECT($A$1),ROW(B2)-2,COLUMN(B2)-2))<>0,CELL("contents",OFFSET(INDIRECT($A$1),ROW(B2)-2,COLUMN(B2)-2)),"")
then drag down and to the right the same number of maximum cells that exist on Source Data and the result will adjust accordingly.
I prepared a Google Sheets document with all of the information.
I have the following search function:
=ALS((VERT.ZOEKEN(B6;'Raw Data'!$H$1:$BB$3000;21;ONWAAR))=100;"Winkel";
ALS((VERT.ZOEKEN(B6;'Raw Data'!$H$1:$BB$3000;21;ONWAAR))=400;"Woning";
ALS((VERT.ZOEKEN(B6;'Raw Data'!$H$1:$BB$3000;21;ONWAAR))=500;"Parkeerplaats";
ALS((VERT.ZOEKEN(B6;'Raw Data'!$H$1:$BB$3000;21;ONWAAR))=200;"Kantoor";
ALS((VERT.ZOEKEN(B6;'Raw Data'!$H$1:$BB$3000;21;ONWAAR))=600;
"Antenne";"Overig")))))
But when I change and delete some of the columns in the range of the Vlookup search with a macro (Vert.Zoeken=Dutch for Vlookup) The Range specified within the formula changes.
Why does it do that, and how do i stop it? I Couldn't find a clear answer anywhere else.
(The macro code just deletes some columns, and doesn't do anything else really)
Cell ID vs Cell Location
One of Excel's primary mechanics is that each cell effectively has its own "ID", which is represented by that the location of that cell at the time that it was referenced. The location of that cell can change, when columns & rows are manipulated.
For example: in A1, make the formula
=B5+D3
Then insert a row above row 3, and a column to the left of B. Your formula will now read:
=C6+E3
You'll notice that because the locations of the unique cells was changed, the formula accounted for that. This feature is incredibly useful, as otherwise, even simply formulas would need to be completely re-written if a new header was inserted above some numbers.
If you want the position of a reference to be "absolute" in the sense that it always points to the same location instead of the same cell ID, then you have a few options:
VBA solution to ignore this feature
By its nature, VBA code does not automatically adjust when cell references change. If you have a formula which references Range("B5"), then it will still say Range("B5") after you insert a new column to the left of B. In this way, you could use VBA to build the formulas within your worksheet. ie: VBA could re-write the formulas to reference the columns you want it to.
Excel solution to ignore this feature
To solve this without VBA, meaning your VBA code would not need to re-write the formulas, you could use the INDIRECT function. INDIRECT allows you to dynamically determine what a cell reference is, based on building a text string of a location. For example:
=VLOOKUP(A1,INDIRECT("B"&5+10&":D100"),2,0)
This will create the text string "B15:D100", and that will be the range referenced by VLOOKUP. Because you have entered the "B" & "D" as text values, they will not change when you insert rows/columns.
Is there a way to make the substitute function target cells that the formula isn't written in.
So an example would be cell A1 contains "A" but when cell B1 contains "A" cell A1 changes to "x"
The substitute function does this but I want to be able use the formula typed in a cell of my choosing.
No function can change a value in another cell. Functions only return values to the cell in which they reside. You need to change the cell manually or with VBA, or better yet, revise your data architecture to work with Excel, not against it.