Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello,
In Mathcad prime, when a value is looked up from an Excel sheet, the output will be placed in a square bracket , I assume it is an array. When I use the looked it up value and compare it with another value, it gives an error saying it must be a scalar. What do I need to do to the looked up value to make it a scalar?
Thanks,
Sam
Solved! Go to Solution.
Lookup will always return an array because its quite possible that more than one value fulfills the condition given. So you also get a 1x1 array if just one single entry applies.
You may choose the very first entry in the list by adding the matrix index 0 (assuming that ORIGIN=0)
You may also consider to use a user-written lookup function, placed somewhere at the top of the sheet (maybe in a collapsed region) which does that job:
Thanks to the try,,,on error it will not throw an error if no match was found but returns a NaN (or change to whatever you feel appropriate).
Unfortunately user functions can't have an optional argument. So if you need the lookup function with the optional fourth argument you would have to use a second user function
Lookup will always return an array because its quite possible that more than one value fulfills the condition given. So you also get a 1x1 array if just one single entry applies.
You may choose the very first entry in the list by adding the matrix index 0 (assuming that ORIGIN=0)
You may also consider to use a user-written lookup function, placed somewhere at the top of the sheet (maybe in a collapsed region) which does that job:
Thanks to the try,,,on error it will not throw an error if no match was found but returns a NaN (or change to whatever you feel appropriate).
Unfortunately user functions can't have an optional argument. So if you need the lookup function with the optional fourth argument you would have to use a second user function
Thank you Werner!