Can't use Get xls lookup in If then else function

Use this forum to post Vensim related questions.
Post Reply
VSEE1906
Junior Member
Posts: 3
Joined: Fri Mar 16, 2018 5:51 pm
Vensim version: DSS

Can't use Get xls lookup in If then else function

Post by VSEE1906 »

Hi,

I am new in Vensim and just developed a small model for energy demand based on GDP and Energy Intensity (EI) considering a time frame 2000-2035. EI has historical data from 2000 to 2016, and I have used a variable named "Historical Energy Intensity by Sector and Source" which gets the data from an Excel file using GET XLS LOOKUPS. I have another variable named "Projected Energy Intensity by Sector and Source" which uses equations in order to determine EI from 2017 to 2035.

I also have created a Variable named "Energy Intensity by Sector and Source". I tried to use the IF THEN ELSE function in order to get "Historical Energy Intensity by Sector and Source" for time <=2016, and "Projected Energy Intensity by Sector and Source" from 2017 to 2035. When I check the model an error appears stating that I cannot use a lookup as argument in the IF THEN ELSE function. Is there any other way to call the data?

Thanks
Attachments
Data input Ecuador.xlsx
(211.99 KiB) Downloaded 169 times
20180315_Demand-GDP_EI.mdl
(4 KiB) Downloaded 187 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Can't use Get xls lookup in If then else function

Post by tomfid »

GET functions have to appear first on the left hand side of an equation. See http://vensim.com/documentation/fn_get_xls_lookups.htm

Make the lookup a separate variable containing the GET. Then you can use it in other equations. Like:
mylookup = GET XLS LOOKUP( ...
price = IF THEN ELSE( time > 2, mylookup(quantity), ...
Post Reply