Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Vlookup on partially sorthed lists

Hi,

I am using a vlookup function without the false argument on a list (2400
items) that is mostly sorted, except for a few values (35) right at the
bottom of the list that have a 0 value. I was under the understanding that
the vlookup function stepped through the list until it came to a value that
was greater than the lookup value at which time it brought back the relevant
value from the nominated column to the right.

On the data I have the function works OK until I try and lookup a value
exceeding row +-2300. At this point the function brings back a 0 which is
the data corresponding to one of the 0 value items. When I delete the 0
value items off the bottom of the list the vlookup works OK. The reason the
data has a bunch of 0's on the end is that it is a dynamic list (made up of
formulas that refer to other dynamic data).

To replicate:
Place 1 in B7 and C7
Place formula "=+B11+1" in B8 and copy down to B2401, copy also to
column C
Place value "0" in B2402 to B2436 and C2402 to C2436
Place value 2200 in D7
place "=VLOOKUP($D$7,$B:$C,2)" in E7
Change value in D7 to 2300 and a result of 0 is returned.
The lookup works for all values less than 2200.

Any assistance or explanation will be appreciated.

Sean


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Vlookup on partially sorthed lists

Use a dynamic range that excludes the 0's from the lookup table:

InsertNameDefine
Name: Range
Refers to:

=OFFSET(Sheet1!$B$7:$C$7,,,COUNTIF(Sheet1!$B$7:$B$ 3000,"0"))

As you add new data to the end of the table replacing the 0's the range will
automatically adjust.

Then:

=VLOOKUP(D7,Range,2)

When you use the "sorted" range_lookup argument (you've used it by
omission) and the range is not sorted (as yours wasn't) there's no telling
what result you could get. Typically (but not always), the result will be
the last entry of the lookup table.

Biff

"Sean" wrote in message
...
Hi,

I am using a vlookup function without the false argument on a list (2400
items) that is mostly sorted, except for a few values (35) right at the
bottom of the list that have a 0 value. I was under the understanding that
the vlookup function stepped through the list until it came to a value
that was greater than the lookup value at which time it brought back the
relevant value from the nominated column to the right.

On the data I have the function works OK until I try and lookup a value
exceeding row +-2300. At this point the function brings back a 0 which is
the data corresponding to one of the 0 value items. When I delete the 0
value items off the bottom of the list the vlookup works OK. The reason
the data has a bunch of 0's on the end is that it is a dynamic list (made
up of formulas that refer to other dynamic data).

To replicate:
Place 1 in B7 and C7
Place formula "=+B11+1" in B8 and copy down to B2401, copy also to
column C
Place value "0" in B2402 to B2436 and C2402 to C2436
Place value 2200 in D7
place "=VLOOKUP($D$7,$B:$C,2)" in E7
Change value in D7 to 2300 and a result of 0 is returned.
The lookup works for all values less than 2200.

Any assistance or explanation will be appreciated.

Sean



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 772
Default Vlookup on partially sorthed lists

If you don't you false, then it must be sorted in ascending order, if not
then it will match the highest number smaller than your choice, if none are
smaller then it will return #N/A. You could also do away with the zeros with
an if statement.
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"Sean" wrote:

Hi,

I am using a vlookup function without the false argument on a list (2400
items) that is mostly sorted, except for a few values (35) right at the
bottom of the list that have a 0 value. I was under the understanding that
the vlookup function stepped through the list until it came to a value that
was greater than the lookup value at which time it brought back the relevant
value from the nominated column to the right.

On the data I have the function works OK until I try and lookup a value
exceeding row +-2300. At this point the function brings back a 0 which is
the data corresponding to one of the 0 value items. When I delete the 0
value items off the bottom of the list the vlookup works OK. The reason the
data has a bunch of 0's on the end is that it is a dynamic list (made up of
formulas that refer to other dynamic data).

To replicate:
Place 1 in B7 and C7
Place formula "=+B11+1" in B8 and copy down to B2401, copy also to
column C
Place value "0" in B2402 to B2436 and C2402 to C2436
Place value 2200 in D7
place "=VLOOKUP($D$7,$B:$C,2)" in E7
Change value in D7 to 2300 and a result of 0 is returned.
The lookup works for all values less than 2200.

Any assistance or explanation will be appreciated.

Sean



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Vlookup on partially sorthed lists

Thanks guys,

I guess that the answer is that if the list is not sorted that I can expect
sporadic results. Thanks for the suggested work arounds. Much appreciated.

Sean


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop-down lists in vlookup NAS Excel Discussion (Misc queries) 6 July 14th 06 06:56 AM
VLookup a Vlookup adamb2000 Excel Worksheet Functions 4 June 28th 06 10:54 PM
Lookup Data in two seperate Spreadsheets Padraig Excel Worksheet Functions 6 June 28th 06 03:05 PM
VLOOKUP Limitations chris_manning Excel Worksheet Functions 2 August 9th 05 06:23 PM
vlookup data hidden within worksheet Excel Worksheet Functions 0 January 26th 05 12:09 PM


All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"