My workbook contains a summary sheet which summarises the data held in the other sheets. My current formula in the summary sheet in cell C6 adds up cell B7 in all of the other sheets, RKW3455 being the first sheet to include in the calculation and Batch_20 bring the last sheet to include.
=SUM('RKW3455:Batch_20'!B7)
It works fine but the tab names will change and so to avoid having to change the sheet name within the formula I wanted to put the first sheet name into J2 and the last sheet name into J3. Then I wanted to reference those cells in the formula which will just make it easier to amend when there are new sheets. I can't get it to work though. This is what I have:
=SUM(INDIRECT("'"&J2):INDIRECT(J3&"'"&"!")B7)
I've also tried
=SUM(INDIRECT("'"&J2):INDIRECT(J3&"'")!B7)
Can anyone correct where I'm going wrong please?
Thanks
Used a workaround as suggested by Jeeped and Darren Bartrup-Cook in the comments. Created a 'start' sheet and an 'end' sheet to sum the sheets in between.
Related
I have a Excel doc with a master log sheet that I would like to link to cells in other detailed sheets. The main sheet is called RFI Log and the other sheets are RFI001, RFI002, RFI003, etc.. Ideally on the RFI Log sheet in the Status column the formula would be =RFI_001!$A$18 and that would show the Status of RFI001. It works great. But I have over 50 RFI Sheets with a dozen fields that I want on RFI Log. Without having to type in the formula in each cell on RFI Log is there a faster way to replicate the formulas? I have tried all my cell locking tips ($) but when I drag a corner of a cell to pull down the formula the sheet name doesn't change incrementally. For example if I drag the cell =RFI_001!$A$18 the next cell turns into =RFI_001!$A$19 and not =RFI_002!$A$18.
Something like =INDIRECT"RFI_"&TEXT(SEQUENCE(18),"000")&"!A"&18-SEQUENCE(18))
INDIRECT should help you here. Usage: =INDIRECT(cellWithSheetName&"!A18")
You don't need the $ to fix column or row when dragging the formula. Just create a range of your sheet names and let the sheet name reference be adjusted when you drag the formula.
I am trying desperately to use the INDIRECT function to pull the values from the same cell on multiple worksheets but all I keep getting is #REF. I have all the sheet names in column I. I tried =INDIRECT(I2&"A1") with I2 being the cell with the sheet name and A1 being the cell on that sheet I want to pull the data for. I'm not sure what's going wrong....
You need an exlamation mark.
Try =INDIRECT(I2&"!"&"A1")
It works for me.
I have a somewhat working solution to retrieve all sheet names from a excel spreadsheet without using macro's or VBA. I did find several solutions but they all required the file to be saved as macro-enabled spreadsheet or external tools.
My solution is this so far:
My First sheet is called 'First' and my last sheet is called 'Last'. In between I have several sheets with random names. These sheets in between have in the A1 Cell the following formula:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)&"\"
The first sheet has in B1 the following formula:
="\" &CONCAT(First:Last!$A$1)
And in B2 to Bx the following formulas:
=IF(ISERROR(FIND(CHAR(1),SUBSTITUTE($B$1,"\",CHAR(1),ROW()))),"",MID($B$1,FIND(CHAR(1),SUBSTITUTE($B$1,"\",CHAR(1),ROW()-1))+1,FIND(CHAR(1),SUBSTITUTE($B$1,"\",CHAR(1),ROW()))-FIND(CHAR(1),SUBSTITUTE($B$1,"\",CHAR(1),ROW()-1))-1))
To explain this:
FIND(CHAR(1),SUBSTITUTE($B$1,"\",CHAR(1),ROW()-1))
gets the occurrence of the the string "\" in $B$2 relative to the row. In A2 this is the first occurrence.
LEN($B$1)-LEN(SUBSTITUTE($B$1,"\",""))
gets the amount of occurrences of "\" in $B$2
ISERROR(FIND(CHAR(1),SUBSTITUTE($B$1,"\",CHAR(1),ROW())))
makes the values empty so dynamic named range can be created from it. I use the sheet for dropdowns and charts
For end-users I hide the first and last tab so they don't accidentally break the sheet.
Somehow this all works, but maybe anyone has a better solution. It looks a bit overkill. Does anyone know of a better solution??
Thnx,
Jorden
This is only an alternative:
in A1 of each sheet enter:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
In A2 of the first sheet enter:
=TEXTJOIN("*",TRUE,First:Last!A1)
In A3 of the first sheet enter:
=TRIM(MID(SUBSTITUTE(A$2,"*",REPT(" ",999)),ROWS($1:1)*999-998,999))
and copy down:
(I don't know is this is any simpler.)
I'm importing a text file into one sheet, eliminating un-needed lines, while formatting the data on the second sheet.
I have all the formulas on the second sheet set up, referencing cells on the first sheet.
The problem is that after deleting the un-needed lines and the data moves up, the formulas for the deleted lines say #ref. I want the formulas to use, say Sheet1!B2 no matter what data is there.
I see that Indirect works, so the next question is, how can I copy the Indirect function down a colum of 500 rows with each one having the right reference?
Thanks
I had this same problem recently so just passing along the answer I got. Index functions will help. Below you can see one where the sheet name is reference in cell a1 and it will return the value in cell a2 of the corresponding sheet.
=INDEX(INDIRECT($A1&"!2:2"),COLUMN(A:A))
If you only need to reference cells on the same row, including cells on different sheets on the same row, there's an easier way than Indirect.
If you write in A42:
=#B:B
it will look up B42.
If you write in A42:
='Sheet 2'!#X:X
It will look up X42 on Sheet 2.
If you delete the top rows on Sheet 2, the formula on Sheet 1 will point to the new X42 - no #REF! errors.
As long as your formulas in Sheet 1 just need to reference cells on the same row in Sheet 2 - so the formula in 'Sheet 1'!A42 might want 'Sheet 2'!X42 but not 'Sheet 2'!X43 - you can just put the column names as inputs into the formula. Otherwise you'll need Indirect.
For bonus points, name the columns in Sheet 2, so instead of ='Sheet 2'!#X:X you could write =cust_DateOfBirth for example.
I am working with 2 sheets in a single spreadsheet and I want to link the items of cells of first sheet to the cells of second sheet so that when I make any change in a cell in one of the sheets the same change should take place in another sheet in its linked cell.
I followed what is being suggested here Linking cells in same Excel spreadsheet but it didn't work. Thank you.
If the sheet you are making changes to is Sheet2, in sheet1 just use something like =Sheet2!A1 and the cell will directly show whatever is in the cell A1 in sheet2, etc.
If both sheets need hard coded values then you'll need to do something more complicated, like an event in VBA.