Pull Out Second from a list

W

WhytheQ

Is there an easy way to do the following:
I've got the following table

Jon 1
Jon 20
Jon 30
Mark 5
Mark 6
Jimbo 89
Jimbo 58

if i use vlookup(Jon,myTableArea,2,false) then it returns 1.
what I want is to be able to use a formula so that I can easily return
20 or 30 i.e have a cell where when I change its value from 1 to 2 to
3, the formula will return 1, 20 or 30.

is this possible to do easily?

any help appreciated
Jason.
 
M

Max

Assume data as posted is within A1:B7

In C1: =COUNTIF($A$1:A1,A1)
Copy C1 down to C7

Col C drives out the occurences count for the names listed in col A

Then if we have the lookup pairs of values for the names & occurences
listed in E1 and F1 down, eg in E1:F3 are say:

Jon 2
Mark 1
Jimbo 2

we could put in G1's formula bar, and array-enter the formula,
i.e. press CTRL+SHIFT+ENTER to confirm the formula
(instead of just pressing ENTER):
=INDEX($B$1:$B$7,MATCH(1,($A$1:$A$7=E1)*($C$1:$C$7=F1),0))
Copy G1 down to return correspondingly

We'd get the desired results:

Jon 2 20
Mark 1 5
Jimbo 2 58

Changing the occurence #s in F1:F3 will yield, for eg:

Jon 1 1
Mark 2 6
Jimbo 1 89
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top