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
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.
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.
TTFN

FAQ731-376: Eng-Tips.com Forum Policies
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers
RE: MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.
RE: MathCAD 15 - For a given value, find value greater than in a table and return a string in column 2.
That code worked a treat. Thanks a bunch!