Count if

Use this forum to post Vensim related questions.
Post Reply
flo
Junior Member
Posts: 2
Joined: Tue Jan 22, 2013 9:51 am
Vensim version: DSS

Count if

Post by flo »

Hey there,

I'm using Vensim DSS and what I try to do is to create (or use an existing?) function that works he way the "COUNT IF"-Command in IBM SPSS or MS Excel does. The model is connected to database and i want to count the number of certain values in the database list (for example COUNT IF VALUE=7). Is that somehow possible?

Thanks a lot!
Administrator
Super Administrator
Posts: 4611
Joined: Wed Mar 05, 2003 3:10 am

Re: Count if

Post by Administrator »

You will need to use something like

Code: Select all

sum ( if then else ( value[range!] = 7 , 1 , 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
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: Count if

Post by tomfid »

It's not entirely clear what you're counting, but GET DATA TOTAL POINTS might also be useful.
flo
Junior Member
Posts: 2
Joined: Tue Jan 22, 2013 9:51 am
Vensim version: DSS

Re: Count if

Post by flo »

The function sum ( if then else ( value[range!] = 7 , 1 , 0 ) ) works perfectly, thanks a lot.
Post Reply