summing subscripts of a LOOKUP variable
Posted: Thu Feb 03, 2022 2:30 pm
Hello,
I have a few questions here regarding variable that use the GET XLS LOOKUP vs. GET XLS DATA functions.
These functions also dictate the type of variable - The former creates a lookup variable the latter creates a data variable, correct?
What I am noticing is that I cannot use 'normal functions' (i.e. SUM) on lookup variables and I am hoping you can hep me find a work-around solution.
Specifically, I want to a SUM of subscripts from a lookup variable and this creates a error in the model stating, "this is a special type and cannot be used as a normal variable."
For example:
var 1 [sector] = GET XLS LOOKUPS('fileName', 'sheet', 'x_row', 'firstcell of y')
var 2 [sector] = var1[sector](Time+1) - var1[sector](Time)
var 3 = SUM(var1[sector!])
I wanted the 'var1' as a lookup so I could create the 'var2' variable - which operates just fine as a lookup but does not function as a data variable.
But when I try to simulate 'var3', I received the error mentioned above.
Essentially, I have historic input values (var1) and I want to create two other variables computing the variation in each time step (var2) AND the total of all sectors (var3) from those lookups.
Should I make two var1 variables to do this, var1A as a lookup variable to determine var2, and another var1B as a data variable to determine var3?
Or how would you advise determining the (1) variation/change in each time-step (by subscript item), and (2) a sum of all subscripts, of the same exogenous variable?
Thank you.
Please let me know how I can clarify this any further.
I have a few questions here regarding variable that use the GET XLS LOOKUP vs. GET XLS DATA functions.
These functions also dictate the type of variable - The former creates a lookup variable the latter creates a data variable, correct?
What I am noticing is that I cannot use 'normal functions' (i.e. SUM) on lookup variables and I am hoping you can hep me find a work-around solution.
Specifically, I want to a SUM of subscripts from a lookup variable and this creates a error in the model stating, "this is a special type and cannot be used as a normal variable."
For example:
var 1 [sector] = GET XLS LOOKUPS('fileName', 'sheet', 'x_row', 'firstcell of y')
var 2 [sector] = var1[sector](Time+1) - var1[sector](Time)
var 3 = SUM(var1[sector!])
I wanted the 'var1' as a lookup so I could create the 'var2' variable - which operates just fine as a lookup but does not function as a data variable.
But when I try to simulate 'var3', I received the error mentioned above.
Essentially, I have historic input values (var1) and I want to create two other variables computing the variation in each time step (var2) AND the total of all sectors (var3) from those lookups.
Should I make two var1 variables to do this, var1A as a lookup variable to determine var2, and another var1B as a data variable to determine var3?
Or how would you advise determining the (1) variation/change in each time-step (by subscript item), and (2) a sum of all subscripts, of the same exogenous variable?
Thank you.
Please let me know how I can clarify this any further.