I'm struggling to implement a dynamic reference within excel when using dates. The formula I'm using works with other strings but dates seem to be an issue.
=INDIRECT(C$2&"!$C2")
The first instance of C2 is equal to 04-01-2021, the same as the sheet (name) I want to reference.
The second instance of C2 pulls in a [Y]es or [N]o which works fin if the references / sheets are not dates.
Could someone point me in the right direction please?
Thanx for looking,
Sam
EDIT:
I've tried using another suggestion but I'm still getting no joy.
=INDIRECT("'"&TEXT(C2,"dd-mm-yyyy")&"'!"&C2)
This pulls in the date:
=TEXT(C2,"dd-mm-yyyy")
04-01-2021
What am I doing wrong with the indirect function?
EDITv2: I was going to upload an example but obviously I'm too dense to be able to find any sort of upload button / link on stackoverflow.
Figured it.
I was using dates and forgot to wrap my dates in speech marks for them to reference correctly.
Master Sheet C2 contents:
="04-01-2021"
Sheet name:
04-01-2021
Thanx for your help #Carter Bayer
I am not fully understanding what you are seeking to do. Based on your description, I think you are trying to reference the same cell in every worksheet based on a worksheet name?
If so, you should be able to reference the sheet name by simply adding ' to your indirect formula.
Example workbook screenshot
Breaking it down:
Formula = INDIRECT("'"&SHEET_REF&"'CELL_REF")
Where SHEET_REF = Reference sheet name (Reference: Retrieve sheet name)
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
Where CELL_REF = Cell reference (Dynamic worksheet reference)
=!C2
The combined formula would be: INDIRECT("'"&MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)&"'!C2")
Let me know if this works or if I misunderstood your question.
-Carter
Related
I have 2 workbooks and within each book, each sheet are the months of the year. The source book and target book have identical sheet names, eg. Aug 2019, Sep 2019..... I have created the following formula in the target book, cell B9, to pull a value from the source workbook, cell AJ46:
=INDEX('C:\FTPDownloads\Villa Stuff[Occupancy Chart Rev 1d.xlsx]Aug 2019'!$AJ$46,1)
It works fine, even with the source book closed.
In the target book I have loaded cell Q3 with the following formula :
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
This loads cell Q3 in the target book with the current active sheet. So cell Q3's value is Aug 2019.
There are 20 copies of the INDEX formula in the target book, and the only thing that changes is the source cell at the end, which in the formula above is AJ46.
To prevent constant changing of the INDEX formula when I extend the sheets to future months, I would like to use the value in cell Q3 in place of entering the actual sheet name.
I have tried :
=INDEX('C:\FTPDownloads\Villa Stuff[Occupancy Chart Rev 1d.xlsx]"&Q3&"'!$AJ$46,1)
But it produces an error.
I am using Excel 2007.
Firstly, if you only want to return a specific cell, say AJ46, why won't you just reference the cell address directly rather than using an INDEX function? I am sure the following will also return the desired value regardless if the other workbook is open or not.
='C:\FTPDownloads\Villa Stuff[Occupancy Chart Rev 1d.xlsx]Aug 2019'!$AJ$46
Secondly, there have been ample discussions on this topic online and even in this community as in this post. The simple conclusion is:
there is no way to make a dynamic workbook/worksheet/range/cell name using excel formula and return the desired value from a closed workbook.
Thirdly, it can be done using VBA. If it is an option for you, you may want to add #vba to your tags so other contributors may be able to help you as #vba it not my expertise. Someone in the post I mentioned before provided a vba code that works for direct cell reference but not incorporating INDEX. If that's an option for you you may want to give it a go.
Fourthly, for your information it can also be done using PowerQuery but it is only available in Excel 2010 and later versions. Besides, PowerQuery worked best with large raw data-set rather than structured report anyway.
I have a list of all of the sheet names in my workbook on Sheet1 and I am trying, without success, to use the INDIRECT function to reference a cell on another sheet using said name. I am aware that this is a common question, I have looked at about 10 other questions/answers on this website in addition to others. For some reason, those solutions are not working and I am kinda losing my mind.
The sheet names are all in column A
They are named after dates (format mm-dd-yy) <- I'm assuming this is the problem?
The cell that I am trying to reference is always in O1 on every sheet in the workbook.
I have tried:
=INDIRECT(A1&"!O1")
=INDIRECT("'"A1"'&!O1")
and a few other amalgamations. Again, I have looked into so many other solutions at this point I am just left with asking for help with my situation, which is apparently unique (or more likely it is some blaring user error). Please help me before immediately removing the post.
If I have this right, the names of your sheets are dates, and you have the names listed as dates in Column A. So, they will appear as dates, but are actually Excel's background number for a date (days since 1/1/1900).
If you use the Formulas tab in the ribbon to Evaluate Formula, you should see the date pop in to your formula as a 5 digit number.
If you are not doing anything else with these dates, you could try selecting column A and formatting as text. This solved the issue in my test setup. This will still work if you are using the date for other functions, but you will have to tell Excel it's a date using DateValue()
After formatting Column A as text, I used =INDIRECT("'"&A1&"'!O1")
Try,
=indirect(text(a1, "\'mm-dd-yy\'\!\O\1"))
I'm trying to use the countif function to count how many employees complete training late. The required by date and all the completion dates are recorded on a separate workbook.
I know the usual forumula is =countif(range, criteria) and have no issues when I type an actual required by date for the criteria. The issue has to do with referencing a cell in a seperate workbook. The formula looks like this: =countif(xxxxG37:G158,>xxxxG5) with xxxx being the location of the external workbook.
The formula works just fine when I put an actual date (i.e >xxxxG5 = 11/6/17).
The issue has to deal with how I"m referencing the criteria cell.
Any help would be appreciated. Thanks! The data looks as follows:
G5 11/6/17
G37 11/2/17
G38 11/3/17
G39 11/9/17
G40 11/10/17
G41 11/1/17
G5 is the required by date. G37-G41 are the completion dates. I want to count how many of the dates are after 11/6/17.
Here is a typical syntax:
=COUNTIF([b.xlsx]Sheet1!$G$37:$G$41,">" & [b.xlsx]Sheet1!$G$35)
where the formula appears in another workbook (a.xlsx)
I'll try to do my best to explain the situation and what I'm working with.
I am working on creating a quiz within Excel 2010 and am trying to create a function that references another by assigning a point value when either Correct or Incorrect is generated by an existing formula. This is the formula I'm using right now for the quiz:
=IF(C4=Answers!B5,"Correct!","Incorrect")
I want to assign "1" to Correct and "0" to Incorrect and have that number add to a cell on a different sheet.
Any and all help is appreciated!
Using the function suggested by #Dave: If the answers are in ColumnC, your formulae in ColumnE and the correct answers in ColumnB of Sheet Answers then the Correct! results may be counted in the same sheet as the formula with:
=COUNTIF(E:E,"Correct!")
As the questions states, I'm trying to reference some cells from one sheet to another. In one sheet I have the Data to populate some other cells in my Principal sheet
In short: DataSheet > Feeds > PrincipalSheet
I'm trying something like:
"=Data!$A$1"
I've even tried something like:
"=[Book1]Data!$A$1"
But still, I can't find the correct code.
I have SpreadSheetGeat 2010 and using C#
Thanks in advance for the help you provide!!
Find the answer, actually, the formula is OK, I was generating the cell ranges with some manual, over the top code, and all that I needed was to put
MySheet.Cells[add ranges here].Range.ToString();
With this code, SpreadSheet generates automatically in which range you are on in this format : "=[Book1]Data!$A$1", and is based on the range that you put in .Cells[],
For some reason Spreadsheet gear adds "[Book1]" when I try the following code. It didn't seem to work in excel.
MySheet.Cells[add ranges here].Range.ToString();
So I manually set the formula Like so:
cells[ rowIndex, 2 ].Formula = "=IFERROR('MySheet1'!$E$6,0)";