Question

I am trying to do a VLOOKUP but its just not going to cut the mustard. There is no way I can alphabetize the first column in my list.

What I am wondering is there any alternatives or combinations of functions that I could use along VLOOKUP in the case that the list can not be alphabetized?

Was it helpful?

Solution

From the link in your comment on your OP:

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.

It isn't terribly obvious the way that document is formatted, but the qualification that the lookup range must be sorted ascending only applies for when the 4th argument in VLOOKUP is TRUE, or a non-zero positive number, or omitted. (If the 4th argument is a non-zero negative number, the first column must be sorted descending.) In these cases, you are allowing the formula to return a non-exact match.

If you are looking for an exact match only, then you must specify FALSE (or zero) for the 4th argument, and the first column needn't be sorted at all.

If you are looking for an non-exact match on an unsorted range, then something like this should work in Google Sheets (assuming you are looking for a match of C1 in column A, and returning the corresponding entry in column B):

=INDEX(SORT(FILTER(A:B;LEN(A:A));1;1);MATCH(C1;SORT(FILTER(A:A;LEN(A:A));1;1));2)

OTHER TIPS

DGET - there are a bunch of database style functions in google spreadsheets, I suspect DGET is the one you want.

Plain Text: With vlookup 1 and "1" are not the same. If you format the column as plain text it can do the lookup. This works even if your cell has a formula that produces a number.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top