Lookup value - #N/A result - excel

I am using =IF(VLOOKUP(A2;$B$2:$B$11;B2;FALSE); TRUE; FALSE) to lookup a value in the column A.
As you can see my formula does not seem valid. Any suggestions why this is the case?
I appreciate your answer!
UPDATE
I am currently getting with =ISNUMBER(VLOOKUP(A2;$B$2:$B$11;1;FALSE)) only FALSE values. However I want to see True if there is a match:
Update
Using =Not(ISNA(VLOOKUP(A2;$B$2:$B$11;1;FALSE))) and =ISNUMBER(MATCH(A2, $B$2:$B$11, 0)) gives me the same result:

VLOOKUP takes the following arguments:
=VLOOKUP(lookup_value; table_array; col_index_num; [range_lookup])
lookup_value is what will be looked for in the first column of table_array.
table_array is the table in which the lookup_value and the value to be returned are.
col_index_num is the number indicating the nth column within table_array from which the value is to be returned from.
[range_lookup] (defaults to true) indicates the type of lookup, true being approximate and false being exact.
As such, if you want to find if A2 is in table $B$2:$B$11, you need to use a col_index_num of 1.
A simpler formula however would be with MATCH:
=ISNUMBER(MATCH(A2; $B$2:$B$11; 0))
MATCH returns the relative row number in which the value A2 is found. If there is a match, you get a number and hence ISNUMBER returns TRUE.
If you want to check if a value from column B exists in column A, then you have it reversed in the formula you used. Turning it around gives:
=ISNUMBER(MATCH(B2; $A$2:$A$11; 0))

You could also use COUNTIF, i.e. this formula in C2 copied down
=COUNTIF(A$2:A$11,B2)>0

Related

Why does the hlookup function return 0?

Why does this hlookup function return 0?
A1 = 2, B1 = 0, C1 = 0
=hlookup(3,A1:C1,1,true)
Reading the description here: https://support.microsoft.com/en-us/office/hlookup-function-a3034eec-b719-4ba3-bb65-e1ad662ed95f, it says for the range parameter (the last parameter):
"If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned"
The next largest value is 2 (in A1) which is less than the lookup value (3).
Using MS Office 365 Apps for enterprise
HLOOKUP will require that the values be sorted when using TRUE:
https://support.microsoft.com/en-us/office/hlookup-function-a3034eec-b719-4ba3-bb65-e1ad662ed95f#:~:text=If%20range_lookup%20is%20TRUE%2C%20the%20values%20in%20the%20first%20row%20of%20table_array%20must%20be%20placed%20in%20ascending%20order
But we can use MAXIFS if they are numbers:
=MAXIFS(A1:C1,A1:C1,"<="&3)
OR XLOOKUP which does not care if sorted or not.
=XLOOKUP(3,A1:C1,A1:C1,"",-1)
The HLOOKUP function returns 0 because the value 3 is not found in the lookup range A1:A3. The HLOOKUP function performs a horizontal search, i.e., it searches for the lookup value vertically in the first row of the lookup range.
Since the lookup value 3 is not found in the range A1:A3, which only contains the values 2, 0, and 0, the HLOOKUP function returns the value specified in the result_vector argument, which in this case is 1. When the value is not found and the range_lookup argument is set to True (which it is in this case), the HLOOKUP function returns the closest match that is less than the lookup value. In this case, since there is no match, it returns 0.

vlookup comparing value from 1 cell with values in 3 other columns - Need to output value of correct match

I have an excel spreadsheet. I need to check if the value in a cell in column A is present in any cell in columns B, C and D.
Here is my current formula:
=AND( NOT(ISNA(VLOOKUP($A2,$B:$B,1,FALSE))), NOT(ISNA(VLOOKUP($A2,$C:$C,1,FALSE))), NOT(ISNA(VLOOKUP($A2,$D:$D,1,FALSE))) )
This formula works, in that if the value in A2 is present in a cell in column B, C, and D it will return true - It returns false if not.
What I'm looking to do is to return the value in A2 when the match is correct.
Thanks in advance.
To solely answer your question, you can just put this around your formula:
= IF(<your formula>,A2)
This returns whatever is in cell A2 if your formula evaluates to TRUE, and returns FALSE otherwise.
More Info, Suggest you Read
You're not really using VLOOKUP for it's intended purpose. VLOOKUP is used when you want to find a match in a table, then return some other value in the table with the same vertical index.
Since you just want to determine if a certain value is in a range or not, VLOOKUP is overkill.
Instead of VLOOKUP inside the IF statement, you should just do this:
= IF(AND(COUNTIF($B:$B,A2),COUNTIF($C:$C,A2),COUNTIF($D:$D,A2)),A2)
This should return the same result but is shorter and more efficient.

Excel calculation return wrong value

I'm building a simple POS to calculate item cost. I'm able to calculate item cost for Belts and Scarf but when i calculate item cost for jewellery
it return the wrong calculating.
The formula i'm using = B37 * VLOOKUP(B36, A2:B5, 2, TRUE)
Your items aren't sorted. You must sort items (A3:A5) A to Z.
Changing TRUE to FALSE changes the way VLOOKUP works:
If TRUE or omitted, an exact or approximate match is returned. If an
exact match is not found, the next largest value that is less than
lookup_value is returned. The values in the first column of
table_array must be placed in ascending sort order; otherwise, VLOOKUP
may not give the correct value. For more information, see Sort data.
If FALSE, VLOOKUP will only find an exact match. In this case, the
values in the first column of table_array do not need to be sorted. If
there are two or more values in the first column of table_array that
match the lookup_value, the first value found is used. If an exact
match is not found, the error value #N/A is returned.
Change the "TRUE" in your formula to "FALSE" and it should work.
= B37 * VLOOKUP(B36,A2:B5,2,FALSE)

ms excel 2007, vlookup #n/a error

This question is an extension of this - click me:
So I have 7 ordered checkboxes, generating 128 possible combinations of being checked/unchecked. Each checkbox is linked to a cell showing its state - true =1, false =0.
I then have a cell that concatenates the states of all 7 check boxes into a 7 digit string, e.g. 1000011 or 0000000 or 1110011, etc - providing a lookup value for my lookup table (which designates each possible combination to a piece of text).
The problem I am having is that vlookup is not finding the strings beginning with a leading 1, e.g. 1000001, or 1110000, or 1001110, etc, but strangely is matching one of the strings beginning with a leading 1 - "10000000". In other words, when I select only the first check box of the 7, I get text. When I select the first check box in addition to any combination of the other 6, I get an #N/A. When I deselect the first check box, with any combination of the others, I get text. Odd, I know.
Could anyone help with this?
Thanks in advance.
You might check if format at origin is equal to all values at destination, I mean, if you have for example 1000001 in lookup field as NUMBER and at lookup table you have the same value as TEXT, VLOOKUP never going to find it, because to Excel is not the same thing a value as NUMBER and a value as TEXT.
I'm almost sure that in your lookup table you have some values as NUMBER; to solve it you have to select only the column of your lookup table when you have all the possible combinations, then go to Data -> Text To Columns, then click Next -> Next -> Choose 'Text' Option -> Finish
Let us know if that worked for you.
Short answer: Supply FALSE as 4th VLOOKUP() parameter.
If it is omitted, range search is supposed to be TRUE and in such a case order of items in VLOOKUP() list matters, because they are understood as thresholds, not as singular values.
From VLOOKUP() help:
Lookup_value The value to search in the first column of the table array. Lookup_value can be a value or a reference. If
lookup_value is smaller than the smallest value in the first
column of table_array, VLOOKUP returns the #N/A error value.
And now read carefully:
Range_lookup A logical value that specifies whether you want
VLOOKUP to find an exact match or an approximate match:
If TRUE or
omitted, an exact or approximate match is returned. If an exact match
is not found, the next largest value that is less than lookup_value is
returned.
The values in the first column of table_array must be placed in
ascending sort order; otherwise, VLOOKUP may not give the correct
value. You can put the values in ascending order by choosing the Sort
command from the Data menu and selecting Ascending. For more
information, see Default sort orders.
If FALSE, VLOOKUP will only find
an exact match. In this case, the values in the first column of
table_array do not need to be sorted. If there are two or more values
in the first column of table_array that match the lookup_value, the
first value found is used. If an exact match is not found, the error
value #N/A is returned.

VLOOKUP with Alphanumeric codes Failing even though they are equal

What I'm trying to do is use VLOOKUP to search through for an Alphanumeric serial number in a range of data in another sheet. However, it does not seem to be recognizing that there is a match when I know for a fact that there is and that they are formatted exactly the same.
The values I'm working with look like this: FTX1724R3W2
I've ran a =A1=B2 function and it returns TRUE.
I've copied and pasted one to the other to make sure that the formatting is the same, yet it still returns a #N/A.
Using MATCH returns a FALSE as well.
I'm not sure what's going on, do I need to specially format the Alphanumeric codes so that they are "searchable"?
Here is the VLOOKUP that I was using...
=VLOOKUP(L2498, Inventory_List!$A$1:$D$2176, 1, FALSE)
My final goal is that it finds it in the other sheet and returns the value in the first indexed column, which is the name of the inventory object.
VLOOKUP() searches the first column of the indicated range. For the function to be effective, have the serial number column be the leftmost column of your search range.
From Microsoft:
VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
Lookup_value The value to search in the first column of the table
array. Lookup_value can be a value or a reference. If lookup_value is
smaller than the smallest value in the first column of table_array,
VLOOKUP returns the #N/A error value.
Table_array Two or more columns of data. Use a reference to a range
or a range name. The values in the first column of table_array are the
values searched by lookup_value. These values can be text, numbers, or
logical values. Uppercase and lowercase text are equivalent.
Col_index_num The column number in table_array from which the
matching value must be returned. A col_index_num of 1 returns the
value in the first column in table_array; a col_index_num of 2 returns
the value in the second column in table_array, and so on.

Resources