Community Tip - You can change your system assigned username to something more personal in your community settings. X
In the attached image (from Mathcad Prime 3.1) I'm able to use vlookup with a single value. Is it possible to use it with a vector of input values and return a vector of values?
Solved! Go to Solution.
I guess thats only possible if you define an auxiliary user function.
Here are two examples. The first hast the data matrix and the return column hardcoded in the function, the second is more generic.
Both function can be called with a single, scalar argument as well. So you may give them a more meaningful name and use them as vlookup replacement (if you only are interested in the fist find),
I guess thats only possible if you define an auxiliary user function.
Here are two examples. The first hast the data matrix and the return column hardcoded in the function, the second is more generic.
Both function can be called with a single, scalar argument as well. So you may give them a more meaningful name and use them as vlookup replacement (if you only are interested in the fist find),
Thanks Werner, as long as the order of shapes matches the look up matrix, your second solution works perfectly.
Why can't a vector be placed directly into the vlookup?
@dsochor wrote:
Thanks Werner, as long as the order of shapes matches the look up matrix, your second solution works perfectly.
No sure what you mean by that matching order??
Why can't a vector be placed directly into the vlookup?
Because vlookup already has a matrix argument. If the first argument is a matrix/vector, too, you would only be able to vectorize the call if both arguments are of the very same dimension.
But even if that would be the case and you vectorize, Mathcad would cycle through BOTH matrices and so would feed vlookup with a scalar as second argument and this would make vlookaup fail, because the second argument must be a matrix.
So just this (rather useless) example works: