cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Compare results from 'vlookup' function error: "This value must be a scalar"

kwadley
1-Newbie

Compare results from 'vlookup' function error: "This value must be a scalar"

I used the READEXCEL command to create a matrix that I can use Lookup Functions on.

The Lookup Functions work perfectly except I can NOT compare the values as shown below:

Help.png

Help?

1 ACCEPTED SOLUTION

Accepted Solutions

lookup(...) returns a vector of values, not a single scalar.

In your sheet it looks like lookup just finds one value in every case you used it and so the variables you show are 1 x 1 matrices (thats the reason for the square brackets around the numbers). And a matrix - even if its just a 1x1 matrix - can't be compared with a scalar value - therfore the error.

In your case you should use lookup(.....)[0 to just select the first (and obviously only) element. I am assuming you use ORIGIN=0 as per default, other wise change the 0 to whatever you have set ORIGIN to or replace the zero by ORIGIN.

WE

View solution in original post

5 REPLIES 5
ldante
11-Garnet
(To:kwadley)

I can tell that your Iy is in matrix format , try to return the matrix to normal.

ldante
11-Garnet
(To:kwadley)

Or this way

You have matrix with one element as an input value - ]123] - why not 123?

lookup(...) returns a vector of values, not a single scalar.

In your sheet it looks like lookup just finds one value in every case you used it and so the variables you show are 1 x 1 matrices (thats the reason for the square brackets around the numbers). And a matrix - even if its just a 1x1 matrix - can't be compared with a scalar value - therfore the error.

In your case you should use lookup(.....)[0 to just select the first (and obviously only) element. I am assuming you use ORIGIN=0 as per default, other wise change the 0 to whatever you have set ORIGIN to or replace the zero by ORIGIN.

WE

Thanks all!

I followed Werner's advice as my lookup function will ALWAYS return a single value.

Here are my results:

Results.PNG

Top Tags