High Plains Grifter
Board Regular
- Joined
- Mar 9, 2010
- Messages
- 129
Hello, people! Here is my problem, and I hope it moves you to reply:
I need to refer to an array on another sheet, but at the time of writing the formula, I do not know the name of that sheet, and the sheet does not even exist (it is created and named by my macro). When it is created, the name will be put into cell A1 (for eg) and I will then refer to that cell to get the name of the sheet from which I need to extract data. In order to do this (see The Specific Task, below) I need to use something similar to this formula, which is random and useless, but encapsulates the error that is causing me problems, without reams of references etc.
=IF(INDIRECT(A1&"!AS"&ROW(1:2))=2,1,0)
When I evaluate this formula using Excel 2007, It gets to this step (the worksheet needs to function in Excel 97 by the way)
=if(indirect({"JDM!AS1";"JDM!AS2"}) = 2,1,0)
and the indirect command on an array leads to an error. Is there any way to refer to arrays in sheets whose name is unknown at the time of writing the formula, and if so, how is it done?
The Specific Task
I need to collect data sheets of daily activity of 20+ staff members, and bring the data together into one workbook, which pretty graphs etc for supervisor types to pore over. I have done this by opening each activity record, and pasting the data into my workbook, with a separate worksheet for each person the supervisor chooses to sample. I can collect data from single cells on each sheet, such as totals, with no probs, but they want me to be able to show the average activity on Mondays, Tuesdays etc for that person throughout that month. This means I need to look up which days of the month are Mondays etc, and then look up the number of payments made, customers called etc on Mondays, Tuesdays etc and take the average. for each person. I only know how to do this using arrays, and hence the problem as the sheet names to be used are unknown until the macro runs. I do not want to make the macro any longer - it is slow and clumsy already, and besides which... This should not be as hard as I am finding it! The name will be listed in a cell, on the sheet where the formula is, at some point, so why can that not be used? Or can it?
I need to refer to an array on another sheet, but at the time of writing the formula, I do not know the name of that sheet, and the sheet does not even exist (it is created and named by my macro). When it is created, the name will be put into cell A1 (for eg) and I will then refer to that cell to get the name of the sheet from which I need to extract data. In order to do this (see The Specific Task, below) I need to use something similar to this formula, which is random and useless, but encapsulates the error that is causing me problems, without reams of references etc.
=IF(INDIRECT(A1&"!AS"&ROW(1:2))=2,1,0)
When I evaluate this formula using Excel 2007, It gets to this step (the worksheet needs to function in Excel 97 by the way)
=if(indirect({"JDM!AS1";"JDM!AS2"}) = 2,1,0)
and the indirect command on an array leads to an error. Is there any way to refer to arrays in sheets whose name is unknown at the time of writing the formula, and if so, how is it done?
The Specific Task
I need to collect data sheets of daily activity of 20+ staff members, and bring the data together into one workbook, which pretty graphs etc for supervisor types to pore over. I have done this by opening each activity record, and pasting the data into my workbook, with a separate worksheet for each person the supervisor chooses to sample. I can collect data from single cells on each sheet, such as totals, with no probs, but they want me to be able to show the average activity on Mondays, Tuesdays etc for that person throughout that month. This means I need to look up which days of the month are Mondays etc, and then look up the number of payments made, customers called etc on Mondays, Tuesdays etc and take the average. for each person. I only know how to do this using arrays, and hence the problem as the sheet names to be used are unknown until the macro runs. I do not want to make the macro any longer - it is slow and clumsy already, and besides which... This should not be as hard as I am finding it! The name will be listed in a cell, on the sheet where the formula is, at some point, so why can that not be used? Or can it?