Skip to main content
1-Visitor
November 26, 2019
Question

Conditionally reference another worksheet

  • November 26, 2019
  • 3 replies
  • 1363 views

My mathcad worksheet performs various calculations and references another mathcad worksheet that contains various fluid properties. I have several worksheets of properties each for a different fluids and I would like to be able to easily switch which file is being referenced depending on which fluid I am interested in without having to delete the reference and insert a new one.  

 

In my main worksheet with all of the calculations I would like a variable that tells the rest of the worksheet which file to reference. 

     

Fluid = "Fluid 1"

Calculations use properties of "Fluid 1" 

3 replies

21-Topaz II
November 27, 2019

Hi

 

I do not know a way to conditionally reference a worksheet so will be looking at the answers here.

 

I do know how to get round your problem.

 

You can use one worksheet with each property value listed in a matrix.

Each column of the matrix is one property.  Each row of the matrix is one fluid.

You can keep the properties in a text file to easily maintain all the values.

 

Headers form the first row and origin is set at default value of zero.  row 1 is first fluid with properties in the proper column..

 

The enclosed shows how to keep the reference as a text file and how to reference for each property.

Enjoy

Terry

21-Topaz II
November 27, 2019

Hi,

In the main file, add all the references. Then for each fluid you can use a radio button (or button). All the radio buttons will be associated with the same integer variable, for example "flu", so that when you choose a radio button (see example image ), flu will take an integer value and automatically provide the values or other of the chosen fluid.

Buttons as keys:

jdiebold881.jpg

to the button 1 is associated flu=0, and so on.

jdiebold88.jpg

where the functions g1, g2, g3, ... are defined in a reference file.

The variables and constants defined in the references cannot be redefined elsewhere otherwise there is a risk of a crash and the loss of the file.

15-Moonstone
November 27, 2019
Spoiler
 

A radio button or dropdown sounds like one method to address the problem.  You may want to read the data in from excel.  Nesting the data would allow for all the fluid types to be available.  Develop a naming convention, which all selection of the fluid of interest.

 

Good luck.