View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default IF and LOOKUP formulas

John

In certain cases and with certain formulas the data needs to be in ascending
order.

The fourth argument in the formula governs this.

VLOOKUP(lookup_value,table_array,col_index_num,ran ge_lookup)

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.

Your formula includes FALSE as the fourth argument so sorteing is not required.


Gord Dibben MS Excel MVP


On Fri, 8 Dec 2006 11:03:01 -0800, John Bundy
wrote:

Why would info need to be sorted? I have never heard of sorting before a
vlookup. Kind of defeats the purpose.
At any rate the code posted previously works on unsorted data :)
-John

"KC Rippstein" wrote:

Sue,
Need a little more detail to understand what you're after. Remember that
you must have the data sorted on Sheet2 and Sheet3 in order for Lookup to
work correctly. Have you considered using either vlookup or index/match
instead?

"Sue" wrote in message
...
I have three different worksheets and I am trying to use IF and LOOkUP
formulas to search two of the three worksheets for a specific result... I
was
just using the LOOKUP function when I had just one worksheet to look at,
but
now I want it to search two worksheets and thought using the if with the
lookup but... but the logical test is returning a "false" result even
though
it found the correct result.