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.
Related
From column O I would like to lookup column A, starting from my current row, to find the first cell with a comma. Goal is to have the correct date in each row.
Table I'm working in https://i.imgur.com/BByfjzy.png
=MATCH("*"&","&"*",$A$1:INDIRECT("A" & ROW()),0)
If I could just run it backwards that be great but I'm not finding a way that works with wildcards or contains in excel 2010. My other thought was to make an a range based off position, invert it, find the index and do length - index but I'm not sure how I would go about that. I'm pretty new to excel so any help would be apricated.
=MAX(IF(ISNUMBER(FIND(",",A1:INDEX(A:A,ROW()))),ROW(A1:INDEX(A:A,ROW())),))
Instead of MATCH which looks from top to bottom and returns the first match, use MAX to return the max row number of the cell containing ,. You can use either FIND or SEARCH.
If you wrap it in INDEX you get your value:
=INDEX(A:A,MAX(IF(ISNUMBER(FIND(",",A1:INDEX(A:A,ROW()))),ROW(A1:INDEX(A:A,ROW())),)))
It might require to be entered with ctrl+shift+enter. I'm unable to test it in older Excel version.
Edit for further explanation of how it works:
A1:INDEX(A:A,ROW()) is to be read as cell A1 up to the current row in column A. So if you're at row # 10 it would equal A1:A10.
Wrapping that range in FIND returns the position of the character you try to find.
If given character is not found in the cell it returns error #N/A.
So if you have row 1 and 9 containing , in this case, it returns an array of numbers for the hits and errors for the non-hits, for instance {2,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,6,#N/A}
Wrapping that in ISNUMBER changes the non errors to TRUE and the errors to FALSE.
IF takes that array and in case of TRUE (a number) it returns the row number (same indexed range is used).
Then MAX returns the largest row number of that array.
Instead of FIND you could also use SEARCH. FIND is case sensitive, and SEARCH isn't, further on they operate the same).
"The range where the lookup value is located. Remember that the lookup value should always be in the first column in the range for VLOOKUP to work correctly. For example, if your lookup value is in cell C2 then your range should start with C."
But sometimes I want to be able to do dual-direction lookups. Ie, lookup using a key in column A to get the value in column B AND at the same time, in other formulas, lookup the value in B to get the value in A.
The only way I know is to add a column C which mirrors A, then use AB for the first lookup, and BC for the second lookup. But there has to be some cleaner solution. Is there some way to force VLOOKUP to use a different column other than the first one to find the key value, or is there a different function that would allow the equivalent?
As a side note, I am asking about Excel, but I actually use LibreOffice. Presumably the functions should be identical, but an answer that also works in LibreOffice would be preferable.
INDEX/MATCH will do it any direction of search.
So for your example of B --> A:
=INDEX(A:A,MATCH(yourCriteria,B:B,0))
The MATCH returns the row number of the match. The third Criterion of 0 is optional. The 0 is the same as FALSE for the forth criterion of VLOOKUP, in that it looks for an exact match.
The default is 1 with the data sorted it will return the match that is less than or equal to the criteria Like VLOOKUP's TRUE.
From that the INDEX finds and returns the correct value.
With the introduction of the Dynamic Array formula XLOOKUP we can use:
=XLOOKUP(yourCriteria,B:B,A:A,"",0)
I am trying to get to the bottom of an issue I have been struggling with for days, in my example I have to match what is in column G to what is in column A whether it be a complete match or a partial match, then check that the Qty matches and pull across the Sal value. My example works with an exception. If an ID appears multiple times in my Lookup table but has different Qty, it only validates the last one in my reference table. I have put this in to my attached example.
=IFERROR(IF(H2=LOOKUP(2^15,SEARCH($A$1:$A$12,G2),$D$1:$D$12),LOOKUP(2^15,SEARCH($A$1:$A$12,G2),$C$1:$C$12),"Qty Issue"),"UnKnown ID")
I have this in an example file but unfortunately no way to upload it.
Download File
Closest formula put to J2, as your expected K7 (60) and K11 (0) values has no logic
=SUMIFS($C$1:$C$12,$A$1:$A$12,LOOKUP(2^15,SEARCH($A$1:$A$12,G2),$A$1:$A$12),$D$1:$D$12,H2)
Syntax
LOOKUP(lookup_value, lookup_vector, [result_vector])
If the LOOKUP function can't find the lookup_value, the function
matches the largest value in lookup_vector that is less than or equal
to lookup_value.
If lookup_value is smaller than the smallest value in lookup_vector,
LOOKUP returns the #N/A error 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)
I am using current forumla in excel but it returns NA. May I know any problem on it
LOOKUP(5,{10,7;9,14;8,14;7,14;6,28;5,28;4,28;3,42;2,42;1,42})
On microsoft's support page on this, it states:
If lookup_value is smaller than the smallest value in the first row or column (depending on the array dimensions), LOOKUP returns the #N/A error value.
And most importantly:
Important The values in array must be placed in ascending order. For example, -2, -1, 0, 1, 2 or A-Z or FALSE, TRUE. If you do not do so, LOOKUP may not give the correct value. Uppercase and lowercase text are equivalent.
Your first row is: (10,7), and 5 is smaller than 10, so it returns #N/A
If you put your values in ascending order, it should work.
My question would be "why are you using LOOKUP?" - If you expect an exact match then LOOKUP isn't the best function, VLOOKUP would be better, i.e.
=VLOOKUP(5,{10,7;9,14;8,14;7,14;6,28;5,28;4,28;3,42;2,42;1,42},2,0)
That will return 28 and if you change the lookup value to any of the listed values in the lookup range it will still work
If the lookup value is changed to a value that isn't in the list, e.g. 5.5 or 11 you will get #N/A error