Subscript Data From Spreadsheets

Use this forum to post Vensim related questions.
Post Reply
impactdynamics
Junior Member
Posts: 16
Joined: Thu Mar 25, 2004 6:50 pm

Subscript Data From Spreadsheets

Post by impactdynamics »

I have built a client model which pulls in data from an Excel spreadsheet using GET XLS DATA and GET XLS CONSTANTS using Names in the formulae - works very well.

I now want to make the model multi-dimensional using subscripts

Please advise or point me in the right direction in order to determine:

1. How to format the subscripted time series data and constants in the spreadsheet

2. How to name the subscripted data in the spreadsheet - ie do you need to create a name for each separate data item or just the first cell in a suitably formatted table

Many thanks

Roger

[Edited on 2-5-2007 by impactdynamics]
Lee Jones

Post by Lee Jones »

Roger,

I have attached an example model pulling data from a spreadsheet into subscripted variables and also using named ranges. I will post the accompanying spreadsheet in the next post.

You will see in the example that Demand, Supply Available and Priority are read from the spreadsheet and are subscripted. My preferred method is to create a single named range in Excel for all elements of a single subscripted constant, although the manual also suggests entering a reference to the first cell only.

Hope this helps

Lee
Attachments
Allocate_with_xls.mdl
(6.57 KiB) Downloaded 347 times
Lee Jones

Post by Lee Jones »

.. and here is the excel data file for the sample model.

Lee
Attachments
xlsdatafile.xls
(16 KiB) Downloaded 314 times
impactdynamics
Junior Member
Posts: 16
Joined: Thu Mar 25, 2004 6:50 pm

Post by impactdynamics »

Thanks Lee

yes it does - thanks


Please see marked up spreadsheet with call out questions

Rog
Attachments
xlsdatafile_rd.xls
(16.5 KiB) Downloaded 295 times
impactdynamics
Junior Member
Posts: 16
Joined: Thu Mar 25, 2004 6:50 pm

Post by impactdynamics »

thanks Lee - this is great

Now the Vensim model makes it much clearer.

It gives me a great start - I shall experiment with this

What is the significance of the ? in '?data.xls' - I thought you needed the whole filename ie 'xlsdatafile.xls' - is this some kind of useful shorthand?

Does the datafile always have to be in the same directory as the model?

What do you do if you need 3 dimensional data - as I do - Region-Inspection-Resource?

What would the Time Series Demand array look like if you wanted another dimension on it eg Demand for each region?

Many thanks again

Rog
Lee Jones

Post by Lee Jones »

Originally posted by impactdynamics
What is the significance of the ? in '?data.xls' - I thought you needed the whole filename ie 'xlsdatafile.xls' - is this some kind of useful shorthand?

Does the datafile always have to be in the same directory as the model?
Rog
data.xls is a placeholder reference to the actual xls file used by the model (hence the "?").

Go to menu option model>settings>xlsfiles and enter "Data" in the "For the reference" field (no need to enter a "?" char). Then select the actual spreadsheet to refer to. This approach means that if you change the spreadsheet name you don't have to modify all the equations using getxls functions.

Also, there is no requirement to have the spreadsheet in the same directory as the model.
impactdynamics
Junior Member
Posts: 16
Joined: Thu Mar 25, 2004 6:50 pm

Post by impactdynamics »

many thanks Lee


Best regards

Rog
Lee Jones

Post by Lee Jones »

Originally posted by impactdynamics
Please see marked up spreadsheet with call out questions

Just seen this. In my preferred method, all cells covering data for a single subscripted array are named (have a look at the named ranges already entered in the spreadsheet). So, for example, in the Demand section, the cells containing the figures 500, 300 and 750 have been grouped and named "Demand" for reference in the relevant GET_XLS_CONSTANTS function in the Vensim model.
impactdynamics
Junior Member
Posts: 16
Joined: Thu Mar 25, 2004 6:50 pm

Post by impactdynamics »

this seems to work really well - thanks Lee

Rog
Post Reply