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)))
Related
I'm trying to create a formula in Workbook1 that automatically pulls data from Workbook2. There is a new tab for each day in Workbook2 and are named Sheet1, Sheet2, Sheet3, etc. My ideal formula would pull the data using vlookup, while automatically incrementing the Sheet number by one each time I autofill the formula one column to the right.
Here is the current formula I have in Workbook1 to pull the data from Workbook2.
A1
(VLOOKUP("JohnSmith",'[Workbook2.xlsx]Sheet1'!$A$50:$O$79,3,FALSE)
B1
(VLOOKUP("JohnSmith",'[Workbook2.xlsx]Sheet2'!$A$50:$O$79,3,FALSE)
C1
(VLOOKUP("JohnSmith",'[Workbook2.xlsx]Sheet3'!$A$50:$O$79,3,FALSE)
In A1:
VLOOKUP("JohnSmith",INDIRECT("'[Workbook2.xlsx]Sheet" & COLUMN() & "'!$A$50:$O$79"),3,FALSE)
This might be too easy for many but i need an help.
I have following formula in Sheet1 which takes the value from Sheet2 M3 Cell
='Sheet2'!M3
M3 cell in Sheet2 has a formula inside which is following:
=INT(NETWORKDAYS(K3;L3)/5)+1
I want to paste the formula inside M3 to my formula in Sheet1 but when i do this as following i get an error.
='Sheet2'!INT(NETWORKDAYS(K3;L3)/5)+1
Can anyone tell me what is wrong here and how i can paste this formula correctly so it works?
Your question was a bit confuse, but:
Do you want the NETWORKDAYS formula to get data from Sheet1 itself?
If yes, just erase the 'Sheet2'! part of your formula.
2. Do you want the NETWORKDAYS formula to get data from Sheet2?
If yes, this is the final formula:
=INT(NETWORKDAYS('Sheet2'!K3;'Sheet2'!L3)/5)+1
The problem is that you should use Sheet reference ('Sheet2'!) before cells, not before formula, so that Excel knows where it should get the data.
say we have:
Sheet1 cell A1 contains the formula:='Sheet2'!M3Sheet2 cell M3 contains the formula:=INT(NETWORKDAYS(K3;L3)/5)+1Select the A1 cell and run this short macro:
Sub FormulaGrabber()
Dim s As String, r As Range
With ActiveCell
s = .Formula
Set r = Range(s)
s = r.Formula
.Formula = s
End With
End Sub
The macro will go to Sheet2, grab the formula in M3 and put it back in Sheet1
As you can see in the image or formula below, I am writing a series of formulas that are referencing the sheet "Lulu." Instead of rewriting "Lulu" over and over, I would like to write Lulu once in cell B1 and reference cell B1 inside the formula.
=AVERAGE(LULU!$C$4:$C$5)/AVERAGE(LULU!$D$4:$D$5)-1
Use INDIRECT(), but this will be longer:
=AVERAGE(INDIRECT("'" & B1 & "'!$C$4:$C$5"))/AVERAGE(INDIRECT("'" & B1 & "'!$D$4:$D$5"))-1
I have a workbook (we are using them for electronic purchase orders) and I need to be able to copy a worksheet but have the formula in it increment like it would if I copied the formula in a sheet.
In other words in sheet2 I1 the formula is ='Sheet1'!$I$1+1. When I copy sheet2 and it becomes sheet3, I need the formula in I1 to say ='Sheet2'!$I$1+1.
How can i do this?
You can get a string containing the current sheet name with the following formula
=cell("filename",A1)
If you are using the standard Sheet# for your pages, then you can get the current sheet number with this formula (assuming the previous one was in B3)
=RIGHT(B3,LEN(B3) - FIND("]Sheet",B3,1)-5)
Next calculate the number for the previous sheet
=VALUE(B4)+1
Now you can use the indirect function to address a cell in the previous sheet
=INDIRECT("Sheet"&B5&"!B1")
In Sheet4, this will reference B1 in Sheet3.
Copy it to Sheet5 and it will reference B1 in Sheet 4.
I would like a reference sheet1("Index") having A:A (ID#) and B:B (Sheetname). This project has several sheets referenced on sheet1 B:B
For simplicity, sheet1 B:B will reference sheet2("Assets") or sheet3("Locations"). I want to return data from sheet2 or sheet3 depending on sheet1 B:B reference.
Sheet2("Assets") has A:A (ID#), B:B (Description), C:C more info and so on. Sheet3("Locations") has similar data as Sheet2.
Using vlookup I would like sheet1 B:B to direct vlookup to either sheet2 or sheet3.
Normally I would use vlookup table array as follows:
=VLOOKUP(A2,Assets!$B:$C,2,FALSE) or
=VLOOKUP(A2,Locations!$B:$C,2,FALSE)
On sheet1 I've unsuccessfully tried
=VLOOKUP(A2,B2 & !$B:$C,2,FALSE)
How can I use sheet1 vlookup to return data found on multiple sheets?
Another question, is there a simpler way to replace vlookup data errors with blank cell. This is the formula I use:
=IF(IFERROR(VLOOKUP(A2,Assets!$B:$C,2,FALSE),"")<>"",IFERROR(VLOOKUP(A2,Assets!$B:$C,2,FALSE),""),"")
In C2 of your reference sheet, please try something like:
=VLOOKUP($A2,INDIRECT($B2&"!A:D"),COLUMN()-1,0)
copied across and down to suit.