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.)
Related
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.
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'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.
I need to get numbers from cells in other sheets. I am currently doing the following in Sheet 1 in cell D14 (but also in another 100 cells):
=('Sheet Two'!$AA$69*'Sheet Three'!AA$70)
This gets me the information I need. As it happens though I have a cell in Sheet 1 with the names of the sheets I need the information from.
I would like a formula that references the cells in Sheet 1 to get the names so I wouldn't have to manually type in the different sheet names for 100 cells.
So if say I have written in text:
Cell A1: Sheet two
Cell A2: Sheet Three
I need something like:
=(***Name in Cell A1***!$AA$69*'***Name In Cell A2***'!AA$70)
=INDIRECT(INDIRECT("A1")&"$AA$69")*INDIRECT(INDIRECT("A2")&"$AA$70") seems to be of the nature of what you are asking for (where A1 contains ''Sheet Two'! but it looks as though a different layout might be much more effective, or use of Search and Replace.
You could use the INDIRECT formula as pnuts suggested, but simpler like this:
=INDIRECT("'",A1&"'!AA$69")*INDIRECT("'"&A2&"'!AA$70")
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.