T
Tim Edmonds
Hi, could someone please tell me if this is possible ...
I have a complex spreadsheet that calculates statistics for my pool
team. Each season is a separate worksheet in the one single
spreadsheet. There are three databases stored in each worksheet.
A typical formula on my Overall Statistics worksheet would look like
this :
GETWINPERCENTAGE(Season01DB1, Season01DB2, Season01DB3, Season02DB1,
Season02DB2, Season02DB3, Season03DB1, Season03DB2, Season03DB3)
However, since I will be adding Season04DB1, Season04DB2 and
Season04DB3 next season, I will then have :
GETWINPERCENTAGE(Season01DB1, Season01DB2, Season01DB3, Season02DB1,
Season02DB2, Season02DB3, Season03DB1, Season03DB2, Season03DB3,
Season04DB1, Season04DB2, Season04DB3)
My GETWINPERCENTAGE function accepts a ParamArray to handle this
variable number of parameters.
Function GETWINPERCENTAGE(ParamArray dbase() As Variant) As Integer
Now, this function is used A LOT. When I add a new season, I have to
add the text Season04DB1, Season04DB2, Season04DB3 etc. in many many
places. What I would like is to NEVER have to change the function, and
for the data to be picked up in a range.
I can easily use the INDIRECT function to do this:
GETWINPERCENTAGE(INDIRECT(A1), INDIRECT(A2), INDIRECT(A3),
INDIRECT(A4), INDIRECT(A5), INDIRECT(A6), INDIRECT(A7), INDIRECT(A8),
INDIRECT(A9))
and then these cells A1-A9 contain the name of the database (for
example SEASON01DB1). This works fine, but it means I'd just be adding
INDIRECT(A10), INDIRECT(A11), INDIRECT(A12) the next season.
What I'd LIKE is to say something like :
GETWINPERCENTAGE({range of where references are stored})
e.g GETWINPERCENTAGE(INDIRECT(A1:A12))
Then I'd just add the names of the three new databases in one place,
and everything gets updated automatically. The above example does not
work. Can I use a more complex version of INDIRECT to this? If not, is
this even possible?
Thanks!
Tim Edmonds
I have a complex spreadsheet that calculates statistics for my pool
team. Each season is a separate worksheet in the one single
spreadsheet. There are three databases stored in each worksheet.
A typical formula on my Overall Statistics worksheet would look like
this :
GETWINPERCENTAGE(Season01DB1, Season01DB2, Season01DB3, Season02DB1,
Season02DB2, Season02DB3, Season03DB1, Season03DB2, Season03DB3)
However, since I will be adding Season04DB1, Season04DB2 and
Season04DB3 next season, I will then have :
GETWINPERCENTAGE(Season01DB1, Season01DB2, Season01DB3, Season02DB1,
Season02DB2, Season02DB3, Season03DB1, Season03DB2, Season03DB3,
Season04DB1, Season04DB2, Season04DB3)
My GETWINPERCENTAGE function accepts a ParamArray to handle this
variable number of parameters.
Function GETWINPERCENTAGE(ParamArray dbase() As Variant) As Integer
Now, this function is used A LOT. When I add a new season, I have to
add the text Season04DB1, Season04DB2, Season04DB3 etc. in many many
places. What I would like is to NEVER have to change the function, and
for the data to be picked up in a range.
I can easily use the INDIRECT function to do this:
GETWINPERCENTAGE(INDIRECT(A1), INDIRECT(A2), INDIRECT(A3),
INDIRECT(A4), INDIRECT(A5), INDIRECT(A6), INDIRECT(A7), INDIRECT(A8),
INDIRECT(A9))
and then these cells A1-A9 contain the name of the database (for
example SEASON01DB1). This works fine, but it means I'd just be adding
INDIRECT(A10), INDIRECT(A11), INDIRECT(A12) the next season.
What I'd LIKE is to say something like :
GETWINPERCENTAGE({range of where references are stored})
e.g GETWINPERCENTAGE(INDIRECT(A1:A12))
Then I'd just add the names of the three new databases in one place,
and everything gets updated automatically. The above example does not
work. Can I use a more complex version of INDIRECT to this? If not, is
this even possible?
Thanks!
Tim Edmonds