cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
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

Getting A Value From Excel Table

ptc-5179557
1-Visitor

Getting A Value From Excel Table

As a new user of Mathcad, I'm loooking for a way to get a value from an existing Excel table. My purpose is to get the kz value from the table corresponding to the km value calculated previously in an equation on the document. If the value is between the given values in the rows, I want Mathcad to interpolate it. In order to achieve this, I used Readexcel command to address the reference file and inserted an Excel component. As seen in the attached file, I used the vlookup function, but I couldn't succeed it. What is the wrong part?

Also I want the concrete class (C30/C35) to be chosen by combobox like in Excel and make the range to be used for getting the kz value to be dependent on concrete class. Is it possible to do this in Mathcad Prime?

Your replies will be appreciated.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ptc-5179557)

Look if the attached would do what you requested

readexcel.png

View solution in original post

4 REPLIES 4
Werner_E
25-Diamond I
(To:ptc-5179557)

Please post yout worksheet, not just a pic.

Whats the error message you get?

As far as I see you don't have used vlookup() correctly. It takes only 1 matrix as argument (the second). The third argument is not a matrix but just a number which determines the column the return value should be taken from.

The modifier "near" will NOT interpolate, as you request - the return value will be a value of the table you provide.

You will have to write your lookup using iterpolation yourself. Its not that difficult, you will find quite some examples here in this forum from time to time.

If linear interpolation is what you have in mind, you may look in the help for "linterp", otherwise "cspline" might be an option.

To use components like a combo box you will have to use Mathcad 15. Components are not available in Prime.

Werner_E
25-Diamond I
(To:ptc-5179557)

Look if the attached would do what you requested

readexcel.png

Thank you for your help, Werner. Using conditional operator and linear interpolation solved the problem. But I have a small problem with units. If I use units in the formulations, the unitless coefficient km is automatically assigned as Pa and kz can't be calculated. It gives the error message saying "These units are not compatible.". Have you any suggestion to overcome this?

Also, while calculating km, I multiplied the Md value with 10^6 for unit conversion. Is it possible to hide this part directly in the equation?

Werner_E
25-Diamond I
(To:ptc-5179557)

Ali Topaç wrote:

Thank you for your help, Werner. Using conditional operator and linear interpolation solved the problem.

You are welcome. Find attached a somewhat different way to do the C30/C35 selection which does without a branch.

linterp() fails because column 0 and 4 of veri are unitless but you demand Mathcad to look for a value with unit Pa. Ther are two ways out: Either call linterp(..,..,km/Pa) or add the units to veri after reading with veri<0>:=veri<0>.Pa (where <..> is the column selector) and likewise with column 4.

Some questions: What are the units for the rest of the table veri (kx,ka,kz)?

Do you need the whole table in your Mathcad sheet or just the two columns you use so far. In the latter case it would be an option to just read those columns, give them more meaningful names and add the units immedeatly.

Not sure what you mean with hiding the multiplication by 10^6 and what units you will convert that way? If you multiply a value in Pa with 10^6 you will get a value in microPascal but I don't think that its that you are after. Of course you could do without the multiplication if you divide the two columns of veri which you use by 10^6.

EDIT: I just read your post again and stumbled upon "the unitless coefficien km". Why do you think its unitless? The way you calculate it its some kind of pressure - kN.m (or Joule; some kind of moment of force) devided by volume (mm^3).

Tablo3.png

Announcements

Top Tags