Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,814
Default LOOKUP return the value from the previous row

Im using the LOOKUP functions a couple of times in a workbook and it works
correctly in all places except one. Here's an example of what is happening:

A B
1 Jane 20
2 Jack 30
3 Stan 40
4 Dave 50

=LOOKUP(Stan, A:A, B:B)

In most places in my spreadsheet the result would be 40. BUT... in one
particular place the result is 30. Can someone help please?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default LOOKUP return the value from the previous row

The LOOKUP function is required sorted in ascending order. Try VLOOKUP instead

=VLOOKUP("Stan",A1:B100,2,0)


"Steve" wrote:

Im using the LOOKUP functions a couple of times in a workbook and it works
correctly in all places except one. Here's an example of what is happening:

A B
1 Jane 20
2 Jack 30
3 Stan 40
4 Dave 50

=LOOKUP(Stan, A:A, B:B)

In most places in my spreadsheet the result would be 40. BUT... in one
particular place the result is 30. Can someone help please?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default LOOKUP return the value from the previous row

LOOKUP requires the lookup_vector be sorted in ascending order to work
properly.

If the names are unique:

=SUMIF(A:A,"Stan",B:B)

--
Biff
Microsoft Excel MVP

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
Im using the LOOKUP functions a couple of times in a workbook and it works
correctly in all places except one. Here's an example of what is
happening:

A B
1 Jane 20
2 Jack 30
3 Stan 40
4 Dave 50

=LOOKUP(Stan, A:A, B:B)

In most places in my spreadsheet the result would be 40. BUT... in one
particular place the result is 30. Can someone help please?



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,814
Default LOOKUP return the value from the previous row

I apologize, bad example. Names are in ascending order.

A B
1 Dave 50
2 Jack 30
3 Jane 20
4 Stan 40

It works 9/10 times for some odd reason.

"T. Valko" wrote:

LOOKUP requires the lookup_vector be sorted in ascending order to work
properly.

If the names are unique:

=SUMIF(A:A,"Stan",B:B)

--
Biff
Microsoft Excel MVP

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
Im using the LOOKUP functions a couple of times in a workbook and it works
correctly in all places except one. Here's an example of what is
happening:

A B
1 Jane 20
2 Jack 30
3 Stan 40
4 Dave 50

=LOOKUP(Stan, A:A, B:B)

In most places in my spreadsheet the result would be 40. BUT... in one
particular place the result is 30. Can someone help please?




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,814
Default LOOKUP return the value from the previous row



"Steve" wrote:

I apologize, bad example. Names are in ascending order.

A B
1 Dave 50
2 Jack 30
3 Jane 20
4 Stan 40



=LOOKUP(Stan, A:A, B:B)

Expecting 40 but getting 20. It works 9/10 times for some odd reason.

"T. Valko" wrote:

LOOKUP requires the lookup_vector be sorted in ascending order to work
properly.

If the names are unique:

=SUMIF(A:A,"Stan",B:B)

--
Biff
Microsoft Excel MVP

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
Im using the LOOKUP functions a couple of times in a workbook and it works
correctly in all places except one. Here's an example of what is
happening:

A B
1 Jane 20
2 Jack 30
3 Stan 40
4 Dave 50

=LOOKUP(Stan, A:A, B:B)

In most places in my spreadsheet the result would be 40. BUT... in one
particular place the result is 30. Can someone help please?






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default LOOKUP return the value from the previous row

I was able to reproduce your problem if there was a trailing space after
Stan:

Dave...50
Jack...30
Jane...20
Stan<space...40

=LOOKUP("Stan", A:A, B:B)

Returned 20 which is correct based on how LOOKUP works but of course that's
not the result you're expecting.

With the lookup_value being Stan and there not being an *exact* match with
Stan<space the formula looks for the closest value that is less than the
lookup_value. In this case that value is Jane.


--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...


"Steve" wrote:

I apologize, bad example. Names are in ascending order.

A B
1 Dave 50
2 Jack 30
3 Jane 20
4 Stan 40



=LOOKUP(Stan, A:A, B:B)

Expecting 40 but getting 20. It works 9/10 times for some odd reason.

"T. Valko" wrote:

LOOKUP requires the lookup_vector be sorted in ascending order to work
properly.

If the names are unique:

=SUMIF(A:A,"Stan",B:B)

--
Biff
Microsoft Excel MVP

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
Im using the LOOKUP functions a couple of times in a workbook and it
works
correctly in all places except one. Here's an example of what is
happening:

A B
1 Jane 20
2 Jack 30
3 Stan 40
4 Dave 50

=LOOKUP(Stan, A:A, B:B)

In most places in my spreadsheet the result would be 40. BUT... in
one
particular place the result is 30. Can someone help please?





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
Return cursor to previous position Kevryl Excel Discussion (Misc queries) 4 April 19th 07 11:36 AM
return previous date from list [email protected] Excel Worksheet Functions 5 July 20th 06 01:05 AM
Return Path to previous cell Graham F Excel Discussion (Misc queries) 2 May 1st 06 06:38 PM
Return to a previous cell Ken G. Excel Discussion (Misc queries) 2 October 19th 05 07:19 PM
How do I return to a previous worksheet in Excel? chiell Excel Discussion (Misc queries) 2 May 5th 05 02:21 AM


All times are GMT +1. The time now is 12:34 PM.

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

About Us

"It's about Microsoft Excel"