×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.

MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.

MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.

(OP)
Hi all, new to these forums, stumbled upon looking for MathCAD help.

I have tried a couple of things without success so far. I have a 7x2 table like so:

7.09 HA28
8.37 HA32
11.24 HA36
13.75 HA40
17.12 HA45
22.02 HA50
29.3 HA60

For a given value calculated elsewhere, I want to be able to compare that value with column 1 and find the first value that is greater than the given value and return the text in column two.

So for example:

Given Value:
r1: 12.5

Table finds 13.75 >= 12.5

Output:
HA40

I've looked at the lookup functions but am not sure if it is able to/how to compare numerical values that do not match (finding a value greater than) then output a string format? Also considered that the may be a loop involved somewhere..

I have done something similar in excel before but am fairly new to MathCAD.

Any help would be appreciated.

Thanks

RE: MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.

(OP)
Another way I have tried is making two 7x1 vectors (M1 & M2) then using the following:

A1:= match(r1,M1) =

A2:= M.2.A1 =

Couple of problems with this, A1 does not make use of my greater than or equal to requirement ie. it only works when r1 is equal to one of the entries in A1

A2 uses the display tool. It is meant to return the entry in M2 corresponding to the integer entered however I need this to vary, it needs to be A1 really however it won't allow a non integer value, even though A1's answer is an integer.

As I said this doesn't work, it's just something I've tried so far. I'm sure there is a much cleaner way to achieve this.

RE: MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.

(OP)
Hey Occupant,

That code worked a treat. Thanks a bunch!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources