Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Dynamic Excel Component with Mathcad


Dynamic Excel Component with Mathcad

I am using Mathcad Prime 6.0

I'm trying to learn the capabilities of using the excel component with Mathcad. Is it possible to start with an excel component to obtain certain output variables, read that into Mathcad, and then return value(s) back into the same component in excel to continue some calculation process.
i.e. Get "A" and "B" values from the excel component, manipulate the values of A & B to obtain values for a "C" variable. And then read/output the "C" value into the same excel component?

Here are the errors that I faced
when I try to create the loop functionality described above I get the "Variable undefined" for the "C" value I'm trying to send back to excel.
23-Emerald III

Please attach your Prime and excel worksheets, so we may be able to help you.



As Prime is reading the worksheet from top to down, I don't think that its possible to write back the result to the very same Excel component.To do this you would have to turn the component into some sort of function which, as far as I know, is not possible.

But of course you always can read in an external Excel file with READEXCEL, make your calculations and after that write back the result using WRITEEXCEL to the very same Excel file. But this also means that your Prime file would not be self-contained and you have to deal with two files, Prime and Excel.


I tend to agree with Werner.  One idea is that a global definition might work to rewrite variables.  But I can't seem to get it to work (in the 5 minutes I devoted to it.)  Apparently you can't use global definitions inside of programs.    

23-Emerald I

I don't think you can define a global variable as a calculation using a non-global variable.  (Nice idea, though!)

Long ago (really long, circa 1995) there was a Mathcad plug-in for EXCEL (you inserted your Mathcad sheet as a component into the EXCEL sheet.  Then, using the scripting in EXCEL you could paste data into Mathcad and extract computation results.  Mathcad used to have inputs (IN0, IN1, etc) and outputs (OUT0, Ozut1, etc) to define where things came in and were extract3ed from.


That capability disappeared several EXCEL iterations ago, and I don't think Prime would support it anyway.  There still might be a way to script this in version 15, but it would take someone with more knowledge than I.

Thanks for your comment(s).  I suspected there was no current way to create a dynamic loop between Mathcad and an excel component where you could send values back and forth as required.   But since I don’t consider myself a Mathcad expert I figured I would ask more knowledgeable users.  I did try to use a global definition but the program would not permit that.  I guess you have to keep creating copies of the excel component to continue your calculations top-down, as necessary.  



Top Tags