EXCEL INDIRECT both sheet and cell dynamically - excel

In excel 2016 on windows, i am trying to reference dynamically to a sheet and a cell.
For example:
=INDIRECT("'"&$L$2&"'!B33")
Where $L$2 has the sheet name and B33 has a numerical value.
However this does not allow me to have the cell B33 dynamic so i can propagate the formula.
I tried:
=INDIRECT("'"&$L$2&"'!"&B33)
But it throws a #REF!.
Any lead on how to build that formula so that both sheets and cells can be referenced dynamically?

Use INDEX and INDIRECT to refernce the full row, then when it drags to the right we change the column index:
=INDEX(INDIRECT("'"&$L$2&"'!33:33"),1,COLUMN(B33))
Now as is is drug across the column will choose which value to return.

Related

Making the Indirect formula more dynamic by making it change the row (cells) referenced in the formula

I have three excel sheets that are set out the same (they are filled with the same tables but have different values). I have now created another excel sheet which is suppose to sum the values at each cell. For example, take cell G10. All values in this particular cell, across these three excel spreadsheets are summed and presented in this new summary excel sheet. I have created the following ‘indirect’ formula to do it. (I want to use indirect formula as it refers to the name of each worksheet. It is appropriate for this workflow).
Equation (at cell G15)
=SUM((INDIRECT($G$2&"!G15:AV15",TRUE)),(INDIRECT($G$3&"!G15:AV15",TRUE),(INDIRECT($G$4&"!G15:AV15",TRUE))))
($G$2, $G$3,$G$4refers to the worksheet name;
G15:AV15 refers to the particular range…)
The formula works for the particular row, however I want to be able to copy and paste this formula to other cells below and get excel to recognise and change the row number accordingly…
Ie when I copy this formulae to cell value G20, I would want the formula change to reference “G20:AV20.” Does anyone have any recommendations??

How do you filter an excel table with a cell reference?

I am trying to make my spreadsheet more dynamic and would like the tables on the second and third sheets to automatically filter based on a value entered in a cell on the first row. Any ideas?
I have tired to enter the cell reference in the advanced sorting section but it just reads the formula for the cell reference as text and shows zero results.

How to create an offset formula to use the reference in a cell (the cell the formula points to), not the cell address the formula is in?

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.

VLookup Range Change when shifting and deleting columns in the range of the Vlookup function

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.

How to Make One Cell equal different cell values on multiple sheets and locations

I'm working in Excel 2010, and my question is how do I make a cell (say on one sheet to equal a specific value placed on another sheet). I thought the following formula would do it but it doesn't work.
=IF(COUNTIF(Name,$A2)=1,VLOOKUP($A2,Name,2,FALSE),''))
If I understand your question, you simply want one cell to represent the value of another cell from another sheet? If so, the formula will look like this: =[name of sheet]![cell reference] EG: =sheet2!A1
If used in cell A1 on sheet 1, this would put the value of cell A1 from sheet2 into A1 of sheet 1.
If you modify your question so that you reference the actual sheets & cells you're interested in, I can help you with the formula.
You can easily facilitate this by writing your formula in the bar, then when you need to reference a cell on a different sheet, simply navigate to the sheet & cell to insert it's address into the formula, then carry on with your formula if necessary.

Resources