So i'm working on a spreadsheet where i need to lookup a value from a tab of which the name is defined in a cell, in this case D7. Using this method i can dynamically search my workbook tabs and select the correct tab and cell reference.
The problem i'm having is that the cell i'm retrieving will not change when i drag down the formula.
=INDIRECT("'"&$D7&"'!S2")
D7 = dynamic tab name
S2 = cell to retrieve... here is where I'm having the problem, this is a value i want to change when i drag down.
Please can someone help here?
You can use the row of the cell with the formula to calculate the row of the referenced cell:
=INDIRECT("'"&$D1&"'!A" & ROW())
note: the above assumes the formula is in the same row as the cell you are referencing (row 2 in your example)
Related
For i = 1 To staffelRange.Rows.Count
.DataBodyRange.Cells(i, countHeader).Formula = staffelRange.Cells(i).Formula
Next
the code works as intended and copies the formulas from my range into the desired range in my table. first to the formula, the formula always refers to the column header and the cell left of it, if i copy the code now with my function from column 1 to for example column 4, the formula still refers to column 1 instead of column 4. but if i copy it by dragging the formula over to the other cell, the formula adapts. How can I achieve such an adjustment in my code?
Formula:
=$G39*(1+SVERWEIS(Stückpreise_neu_19[[#Kopfzeilen];[Staffel1]];Rabattstaffel_new_24;2;FALSCH))
If the formula is always the same except for the cell reference, you can just write the formula to sheet as a string value with a variable for the correct row number.
Something like...
For i = 1 To staffelRange.Rows.Count
.DataBodyRange.Cells(i, countHeader).Formula = "=$G" & i & "*1+SVERWEIS(Stückpreise_neu_19[[#Kopfzeilen];Staffel1]];Rabattstaffel_new_24;2;FALSCH))"
Next
This is assuming your variable i represents the correct row number for the formula (which to my understanding is correct).
help is appreciated on this topic!
I am trying to reference cell B10 from Sheet2 to cell A1 in Sheet1.
Cell B10 contains the formula SUM(B1:OFFSET(B10,-1,0)), which sums values from B1:B9.
Daily, I add a new row to Sheet2 such that the Column B range increases by +1, from B1:B9 to B1:B10, and the formula from B10 moves to B11.
I now need cell A1 in Sheet1 to reference cell B11 in Sheet2.
I've tried using offset() and indirect() but haven't figured this out.
Thanks for help!
There are (at least) two ways to handle this:
1) Every time you insert the row, make sure you place your cursor on the formula cell before manually inserting row. If you do, the formula in Sheet1!A1 will automatically follow suit, and you can add whatever you need in the new cell (created from the new row). For example, inserting a row at B10 will adjust the formula in A1 to say =Sheet2!B11.
2) Realizing that point 1 may not be suitable to your process, place this formula in Sheet1A1: =OFFSET(Sheet2!B1,COUNT(Sheet2!B1:B100)-1,0) You can adjust the B100 to whatever you need. Just be sure there's nothing in between the the final formula cell and the last row in the this formula range.
I have the following postcode in Cell C2 IV243DLR of excel
In cell C3 I have the following formula
=cleancode(OFFSET(IV243DLR!$C$1,10,ROW()-3))
I have clicked on the tab called IV243DLR for this offset to work.
However what i wish to do is create the same formula using the postcode in Cell C2, since i have different postcodes in D2, E2 etc. Therefore my aim is to create the sheetname using the contents of the cell rather than clicking on each tab. I dont know the syntax on how to create a sheetname using cells. Can someone assist?
If lets say I define cell "B6" name as value_date
How can i get cell address "B6" from a excel formula ?
If by "define cell B6 as value_date" you mean that you create a named range that refers to B6 and has the range name "value_date", then you can use this formula to return the address of the named range:
=CELL("address",value_date)
Be aware that if the named range contains more than one cell, this formula will return the address of the top left cell of the range.
In the screenshot below, cell C6 has the formula as per above.
Edit after comment:
If the range name is stored as text in a cell, you can use the Indirect() function to evaluate the cell text as a range.
=CELL("address",INDIRECT(A1))
To get the row of value_date via the text in cell A1, use =row(indirect(A1))
This should work:
=ADDRESS(ROW(value_date),COLUMN(value_date))
I need help creating a formula in a cell in a spreadsheet that would allow me to grab a value from another cell and use that value to refer to yet another cell in another sheet.
For example, in a cell that returns a student's class grade (a progress report sheet) I have the cell refer to my master grade sheet (eg. the progress report sheet's cell would be: =mastersheet!E[grab value in cell A1 of current sheet])
What formula do I use to grab a cell's value and use it to define/refer to another cell?
In Excel, if Sheet1 A1 contains B2 then in Sheet1 =INDIRECT("Sheet2!"&A1) will return the contents of Sheet2!B2.
In Google Docs spreadsheet, if Sheet1 E1 contains 4 then in Sheet1 =Indirect("Sheet2!E"&E1) will return the contents of Sheet2 Cell E4.