Array used to look up a value in matrix
Array used to look up a value in matrix
(OP)
I have attached a simple file to help illustrate my question. I have the array Wui that gives input values. I need these values to help create another array with the results from Weight_of_Unit. Is this even able to be done and if so, how?
Ryan Erick Broomé, S.E., P.E.





RE: Array used to look up a value in matrix
By default, Mathcad indexes arrays starting with zero for the first row or column. If you want to start with one instead, set the built-in ORIGIN to 1. You can either do this from the Tools/Worksheet Ooptions dialog box or you can set its value in the worksheet ... I prefer to do the latter as it makes it more obvious to others.
The function vlookup(z,m,c) looks for value z in the first column of array m and, for each row where it is found, returns the corresponding values in column c.
Note: in your original worksheet, you had A.i rather than A[i, hence the error as the range variable should (usually) appear on the left hand side of a definition if it's on the right hand side.
RE: Array used to look up a value in matrix
Note: in your original worksheet, you had A.i rather than A[i, hence the error as the range variable should (usually) appear on the left hand side of a definition if it's on the right hand side.
Wow! How did you figure that out??! Onscreen, those two look the same to me. Only after reading your post, did I try each one out, and you are correct. I'll have to remember this for future Mathcad work.
I give you a sar for that.
chichuck
RE: Array used to look up a value in matrix
It's a common occurrence and quite easy to inadvertently type '.' instead of '[', so I tend to look for it when I see odd error messages. The trick is to click on an expression and you should note a slight flicker as Mathcad displays it as 'A.i' rather than 'Ai. In addition, the editing line is limited to just the A when it's a vector and the whole of A.i when its a subscripted name.
Thanks.
RE: Array used to look up a value in matrix
Ryan Erick Broomé, S.E., P.E.
RE: Array used to look up a value in matrix