INDIRECT dragging formula from a different sheet - excel-formula

This formula is on sheet2 and it is pulling information from sheet 1. I want to drag the formula so F12 becomes F13, F14, etc. Everytime I use ROW() or COLUMN() it fails. When I use the & with the row or column function it pulls from sheet2 instead of sheet1. What am I missing here? This formula is on B4 on sheet2.
=IF(ISNA(VLOOKUP(INDIRECT("Sheet1!F12"), $Q$4:$Q$502, 1, FALSE)), 0, 1)

Related

How can I average across sheets defined by an INDIRECT value?

I have 4 sheets in this sample, each with a value in A1, as follows:
Sheet1 - A1=18
Sheet2 - A1=15
Sheet3 - A1=197
Sheet4 - A1=534
Then in Sheet5 I have:
B1='Sheet1
B2='Sheet4
I want an average of A1 cells from Sheet1 to Sheet4, and I can accomplish this easily with the formula =AVERAGE(Sheet1:Sheet4!A1) in Sheet5!A1.
My problem is I want to do that same formula but referencing the sheet values in B1 and B2. I think I need INDIRECT for this, so I tried =AVERAGE(INDIRECT(B1 & ":" & B2 & "!A1")). When I enter that, though, I get a #REF! error. What could Excel be failing to reference?
Try this formula, Workbook
=AVERAGE(INDIRECT("'"&"Sheet"&ROW(INDIRECT(SUBSTITUTE($B$1,"Sheet","")&":"&SUBSTITUTE($B$2,"Sheet","")))&"'!"&CELL("address",A1)))

Excel: Reference a formula in a cell from another worksheet where rows are added

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.

Excel relative cell hyperlink

I have a workbook with sheet1 and sheet 2, sheet1 cell A1 pulls info from sheet2 cell C1, so for easy editing I have hyperlinked sheey2!C1 in sheet1 cell A1.
My issue is that when i delete rows/columbs in sheet 2, the hyperlink does not adapt accordingly and then pull the wrong data, any ways around this?
You can try this to create your hyperlink:
=HYPERLINK(link_location[, friendly_name])
Example:
=HYPERLINK(Sheet2!A2, "A2")
In the given example, if the first row is deleted, the formula is automatically changed to =HYPERLINK(Sheet2!A1, "A2")

If cell A1 in sheet 1 equals 'x' like in sheet 2, then display cell B1 from sheet 2 in sheet 1 cell C2

This might be confusing but I'll give this a go.
As in the title of this question, I need to link cells between two sheets. Seems simple enough, but I think in this case I need to include an IF function?
I want cell C2 in sheet 1 to display what is in cell B2 from sheet 2 IF cell A1 in sheet 1 is the same as cell B1.
In other words: I have 2 sheets, on the second page I have months in on row and in the row under I have values for those months. I want to be able to link sheet 1 and 2 so that if I select February in one cell in sheet 1, then the cell under February in sheet 2 (the value) is shown in another cell on sheet 1.
Help please?
I think the relationships are satisfied by:
=IF(A1='sheet 2'!B1,'sheet 2'!B2,"")
(in Sheet 1!C2) but have assumed that the result should be nothing if Sheet 1!A1 != Sheet 2!B2.
I think you might be looking for in cell C2 (if you are talking about A1 and B1 being from the same sheet like 1):
=IF(A1=B1,Sheet2!B2)
edit: can't read question, only works if A1 and B1 are on same sheet
If I am not misunderstanding your wish, there is the code below. Please insert it into cell C2 in Sheet1
=IF(A1=B1, Sheet2!B2, "")
But you did not provide what sheet of cell B1 in pharse
I want cell C2 in sheet 1 to display what is in cell B2 from sheet 2 IF cell A1 in sheet 1 is the same as cell B1
So, I assumed that it is the same as A1 that is Sheet1. If you want to compare with the cell B2 in another sheet please Insert Sheet2: before B1.

Empty Cells which has vlookup formula

The formula on Column C is
=VLOOKUP($B2,Sheet1!$A$2:$C$100,2,0)
which gets the value from Sheet1 and it works okay.
Now I want to put a condition
If cell D2:D100 is empty then make C2:C100 empty
C2:C100 contains a vlookup formula, and I'd like to clean the formula from the cell.
Secondly, how do we run this in a macro =VLOOKUP($B2,Sheet1!$A$2:$C$100,2,0)?
manimatters has a good solution to use a ISBLANK with an IF formula. If you still want a macro for your second question, I've provided it below.
This macro will set the formula in C2 to =VLOOKUP($B2,Sheet1!$A$2:$C$101,2,FALSE) and then fill this formula down to C100.
Sub RestoreVLookup()
Range("C2").FormulaR1C1 = "=VLOOKUP(R[0]C2,Sheet1!R1C1:R101C3,2,FALSE)"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C100"), Type:=xlFillDefault
End Sub
Let's look at the different parts:
Range("C2").FormulaR1C1 - Assign a formula to cell C2.
"=VLOOKUP(R[0]C2,Sheet1!R1C1:R101C3,2,FALSE)" This is the formula assigned
R[0] - Relative row with an offset of zero. R[1] would point to the row above and R[-1] would refer to the row below.
C2 - The 2nd column (aka column B)
Range("C2").Select - Select cell C2
Selection.AutoFill ... Type:=xlFillDefault - autofill the formula from C2 to C100.

Resources