Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default LOOKUP problem with non-sorted vector

Hey,

Can anybody tell me how to get around excel's requirement that the lookup
vector must have sorted data - if the data isn't sorted it returns an
incorrect value.

Example:
Column A contains: 1,2,3,4,5
Column B contains: 5 blank cells, 4,5,1,3,2
Column C contains: E,D,C,B,A

I want to lookup a cell in column B - B8 (1) in column A - A1 and return the
corresponding value in column C - C1.

Any ideas?

Many thanks,

AMSH
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default LOOKUP problem with non-sorted vector

With A1 thru C10 containing:

1
2
3
4
5
6 4 E
7 5 D
8 1 C
9 3 B
10 2 A

=VLOOKUP(A1,B1:C10,2,FALSE) will display C

The FALSE is important!
--
Gary''s Student - gsnu200814


"AMSH" wrote:

Hey,

Can anybody tell me how to get around excel's requirement that the lookup
vector must have sorted data - if the data isn't sorted it returns an
incorrect value.

Example:
Column A contains: 1,2,3,4,5
Column B contains: 5 blank cells, 4,5,1,3,2
Column C contains: E,D,C,B,A

I want to lookup a cell in column B - B8 (1) in column A - A1 and return the
corresponding value in column C - C1.

Any ideas?

Many thanks,

AMSH

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default LOOKUP problem with non-sorted vector

Hi,

The range only needs to be sorted for nearest match. Try this

=VLOOKUP(B8,A1:C5,3,FALSE)

Mike

"AMSH" wrote:

Hey,

Can anybody tell me how to get around excel's requirement that the lookup
vector must have sorted data - if the data isn't sorted it returns an
incorrect value.

Example:
Column A contains: 1,2,3,4,5
Column B contains: 5 blank cells, 4,5,1,3,2
Column C contains: E,D,C,B,A

I want to lookup a cell in column B - B8 (1) in column A - A1 and return the
corresponding value in column C - C1.

Any ideas?

Many thanks,

AMSH

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default LOOKUP problem with non-sorted vector

=IF(B1="","",INDEX($C$1:$C$5,MATCH(B1,$A$1:$A$5,FA LSE)))
We test to see if the B cell is blank
If not we match B's value with the A vector, and then find corresponding
item in C vector

But since A is 1,2,3,4 we could simplify the last part to
=INDEX($C$1:$C$5,B1)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"AMSH" wrote in message
...
Hey,

Can anybody tell me how to get around excel's requirement that the lookup
vector must have sorted data - if the data isn't sorted it returns an
incorrect value.

Example:
Column A contains: 1,2,3,4,5
Column B contains: 5 blank cells, 4,5,1,3,2
Column C contains: E,D,C,B,A

I want to lookup a cell in column B - B8 (1) in column A - A1 and return
the
corresponding value in column C - C1.

Any ideas?

Many thanks,

AMSH



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
Lookup that returns vector(array) BOB77 Excel Discussion (Misc queries) 3 March 25th 08 07:50 PM
How do I draw 3D vector arithmetic, showing vector subtraction? Colin Kemp Excel Discussion (Misc queries) 0 April 5th 06 07:30 AM
Problem with IF condition or vector lookup? J-Philippe Excel Worksheet Functions 4 January 15th 05 08:41 PM
Vector lookup function GregTh Excel Worksheet Functions 1 November 5th 04 04:19 PM
Vector lookup function GregTh Excel Worksheet Functions 1 November 4th 04 08:34 PM


All times are GMT +1. The time now is 02:31 PM.

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"