A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to look up a value?



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2010, 09:53 AM posted to microsoft.public.excel.worksheet.functions
Kipi
external usenet poster
 
Posts: 6
Default How to look up a value?

I have two column like this:
A B
1 23
2 21
4 20
1 19
4 18
....etc (The numbers in column A are random and do repeat)
What I want to do is to look up a specific value in column A, like 4, and
return the corresponding value of column B with the largest row number, in
this case it's 18 not 20
Any suggestions? =)
  #2  
Old May 13th, 2010, 10:07 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default How to look up a value?

Hi,

Try this. The 4 in the middle of the formula is the lookup value

=LOOKUP(2,1/(A1:A20=4),B1:B20)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Kipi" wrote:

I have two column like this:
A B
1 23
2 21
4 20
1 19
4 18
...etc (The numbers in column A are random and do repeat)
What I want to do is to look up a specific value in column A, like 4, and
return the corresponding value of column B with the largest row number, in
this case it's 18 not 20
Any suggestions? =)

  #3  
Old May 13th, 2010, 10:08 AM posted to microsoft.public.excel.worksheet.functions
Kipi
external usenet poster
 
Posts: 6
Default How to look up a value?



"Kipi" wrote:

I have two column like this:
A B
1 23
2 21
4 20
1 19
4 18
...etc (The numbers in column A are random and do repeat)
What I want to do is to look up a specific value in column A, like 4, and
return the corresponding value of column B with the largest row number, in
this case it's 18 not 20
Any suggestions? =)


Btw the values in column B are also random and repeats.
  #4  
Old May 13th, 2010, 10:57 AM posted to microsoft.public.excel.worksheet.functions
Kipi
external usenet poster
 
Posts: 6
Default How to look up a value?

Thanks for the advice. However, the values in column A and B are random, 4
being in middle is just a coincidence so I don't think it works.
I did a little bit search and found a MATCH function that will return the
NUMBER of match data entry, like if I MATCH with coefficient 4, it returns 2,
meaning 2 entries of "4" in column A.....dunno if this could help


"Mike H" wrote:

Hi,

Try this. The 4 in the middle of the formula is the lookup value

=LOOKUP(2,1/(A1:A20=4),B1:B20)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.



  #5  
Old May 13th, 2010, 11:01 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default How to look up a value?

I suggest you try it. It will find the last instance of the lookup value in
column A and return the corresponding value from column B.

It doesn't have to be a 4 for the lookup value, I used that because you did
in your original question.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Kipi" wrote:

Thanks for the advice. However, the values in column A and B are random, 4
being in middle is just a coincidence so I don't think it works.
I did a little bit search and found a MATCH function that will return the
NUMBER of match data entry, like if I MATCH with coefficient 4, it returns 2,
meaning 2 entries of "4" in column A.....dunno if this could help


"Mike H" wrote:

Hi,

Try this. The 4 in the middle of the formula is the lookup value

=LOOKUP(2,1/(A1:A20=4),B1:B20)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.



  #6  
Old May 13th, 2010, 11:02 AM posted to microsoft.public.excel.worksheet.functions
Kipi
external usenet poster
 
Posts: 6
Default How to look up a value?

Just an amendment. I tried it later and it DOES work! Thank you Mike!
But on top of that can I also return the row number in which the lookuped
value is in?
Thanks again.

"Kipi" wrote:

Thanks for the advice. However, the values in column A and B are random, 4
being in middle is just a coincidence so I don't think it works.
I did a little bit search and found a MATCH function that will return the
NUMBER of match data entry, like if I MATCH with coefficient 4, it returns 2,
meaning 2 entries of "4" in column A.....dunno if this could help


  #7  
Old May 13th, 2010, 11:12 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default How to look up a value?

Fir the row number use

=LOOKUP(2,1/(A1:A20=4),ROW(A1:A20))
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Kipi" wrote:

Just an amendment. I tried it later and it DOES work! Thank you Mike!
But on top of that can I also return the row number in which the lookuped
value is in?
Thanks again.

"Kipi" wrote:

Thanks for the advice. However, the values in column A and B are random, 4
being in middle is just a coincidence so I don't think it works.
I did a little bit search and found a MATCH function that will return the
NUMBER of match data entry, like if I MATCH with coefficient 4, it returns 2,
meaning 2 entries of "4" in column A.....dunno if this could help


  #8  
Old May 13th, 2010, 11:17 AM posted to microsoft.public.excel.worksheet.functions
Kipi
external usenet poster
 
Posts: 6
Default How to look up a value?

It works great! Thanks for your help!

"Mike H" wrote:

Fir the row number use

=LOOKUP(2,1/(A1:A20=4),ROW(A1:A20))
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


  #9  
Old May 13th, 2010, 11:19 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default How to look up a value?

Your welcome
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Kipi" wrote:

It works great! Thanks for your help!

"Mike H" wrote:

Fir the row number use

=LOOKUP(2,1/(A1:A20=4),ROW(A1:A20))
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


  #10  
Old May 24th, 2010, 12:46 AM posted to microsoft.public.excel.worksheet.functions
Ashish Mathur[_2_]
external usenet poster
 
Posts: 1,764
Default How to look up a value?

Hi,

You may also try this formula. D6:E10 is your range of data. D13 contains
4

=INDEX($D$6:$E$10,MAX(INDEX(($D$6:$D$10=D13)*(ROW( E6:E10)-ROW($E$5)),,1)),2)

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Kipi" wrote in message
...
I have two column like this:
A B
1 23
2 21
4 20
1 19
4 18
...etc (The numbers in column A are random and do repeat)
What I want to do is to look up a specific value in column A, like 4, and
return the corresponding value of column B with the largest row number, in
this case it's 18 not 20
Any suggestions? =)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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