multiple IF THEN ELSE equatios

Use this forum to post Vensim related questions.
Post Reply
oludot5
Member
Posts: 23
Joined: Thu Aug 16, 2012 12:01 pm
Vensim version: PLE+

multiple IF THEN ELSE equatios

Post by oludot5 »

Hi
I am wondering how to combine multiple "IF THEN ELSE " statements in the same equation.i.e. how to I represent in a single equation 3 or 4 conditions of a statement with he same IF THEN ELSE equation?
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: multiple IF THEN ELSE equatios

Post by Administrator »

I would try to avoid it where possible as it can make things tricky to debug.

There are two ways. Either embed them

Code: Select all

result = IF THEN ELSE ( a > b , c , IF THEN ELSE ( a > d , e, 0 ) )
or add them (this is my preferred option as I find it clearer).

Code: Select all

result = IF THEN ELSE ( a > b , c , 0 )
+ IF THEN ELSE ( a > d , e , 0 ) )
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
oludot5
Member
Posts: 23
Joined: Thu Aug 16, 2012 12:01 pm
Vensim version: PLE+

Re: multiple IF THEN ELSE equatios

Post by oludot5 »

many thanks
Post Reply