how to return mulitple corresponding values

G

Guest

i want to look up a name that occurs several times in one column of a
spreadsheet and return corresponding values from each row the name occurs on.
Vlookup returns only one value. How can I get multiple values?
 
B

Biff

Hi!

The basic formula is something like this:

Entered as an array using the key combo of CTRL,SHIFT,ENTER:

=INDEX(B$1:B$10,SMALL(IF(A$1:A$10=lookup_value,ROW($1:$10)),ROW(1:1)))

Then copy down.

Where column A contains the lookup_value and column B contains the values to
be returned.

Need more specific details to offer a more robust suggestion.

Biff
 
G

Guest

this formula works if the sheet is sorted by the value i'm looking up and if
there are no duplicates in the field I want returned. Otherwise i get either
incorrect values returned or errors..

basically, i have a sheet listing jobs scheduled by managers. I want to be
able to look up the manager's name and return a list of all the job's
scheduled and the dates they were scheduled on. I then want to include this
in a weekly dashboard for the 50+ managers i'm monitoring.

Thanks for the response, but have you got anything else?
 
A

Alan Beban

If the functions in the freely downloadable file at
http://home.pacbell.net are available to your workbook you might
consider something like

=VLookups(lookup_value,lookup_table,return_value_column)

array entered into a column long enough to accommodate the number of
occurrences of lookup_value.

Alan Beban
 
B

Biff

Hi!
this formula works if the sheet is sorted by the value i'm looking up and
if
there are no duplicates in the field I want returned.

The sheet does not need to be sorted and it doesn't matter if there are dupe
return values.

Post the *EXACT* formula that you tried.
I then want to include this
in a weekly dashboard for the 50+ managers i'm monitoring.
have you got anything else?

Pivot table or filter

Biff
 
G

Guest

Hey Biff, i've got it working now. the first formula below is the one that
works... i removed the row reference numbers in the first reference to the
array...

"=INDEX('Cancel Push compiled'!$A:$W,SMALL(IF('Cancel Push
compiled'!$A$2:$A$82=Sheet1!$A$2,ROW('Cancel Push
compiled'!$A$2:$A$82)),ROW(1:1)),11)"


This is the formula with the row references... i can't understand why this
one doesn't work....

"=INDEX('Cancel Push compiled'!$A2:$W82,SMALL(IF('Cancel Push
compiled'!$A$2:$A$82=Sheet1!$A$2,ROW('Cancel Push
compiled'!$A$2:$A$82)),ROW(1:1)),11)"

Thank you so much!!

"Metrics"
 
B

Biff

This is the formula with the row references... i can't understand why this
one doesn't work....

"=INDEX('Cancel Push compiled'!$A2:$W82,SMALL(IF('Cancel Push
compiled'!$A$2:$A$82=Sheet1!$A$2,ROW('Cancel Push
compiled'!$A$2:$A$82)),ROW(1:1)),11)"

The problem is here:

ROW('Cancel Push compiled'!$A$2:$A$82)

The INDEX function is used to hold the array A2:W82. The actual size of this
array is 81 elements. Where:

A2:W2 = element 1
A3:W3 = element 2
A4:W4 = element 3
...
A82:W82 = element 81

The first call to the ROW function is used to specify which element to
return from the INDEXED array. Since the elements in INDEX are "numbered"
starting from 1, so too must the reference used inside the ROW function. If
the the refernces are mismatched the results you get can and will be
incorrect. (unless you have dumb luck on your side!)

So:

ROW('Cancel Push compiled'!$A$2:$A$82)

should be written as:

ROW('Cancel Push compiled'!$A$1:$A$81)

Another thing, you don't need the sheet name or the columns because you're
not actually referencing any physical location. The ROW function is just a
means to return an array of numbers equal to the size of the INDEXED array.

ROW($1:$81)

Here's another way to look at it:

Assume the indexed range was A247:W327. This array STILL contains 81
elements so:

=INDEX(A247:W327,............................ROW($1:$81)...............)

This is usually where people make mistakes with type of formula. Once you
understand how it works, it's a very simple formula.

Biff
 
G

Guest

I cannot get any of this to work in Excel. I need to lookup a name in Column
A that appears multiple times and bring back each of the values (number) in
Column B.

Please send to email.
 
B

Biff

So:
ROW('Cancel Push compiled'!$A$2:$A$82)
should be written as:
ROW('Cancel Push compiled'!$A$1:$A$81)

Or, it could be written as:

ROW('Cancel Push compiled'!$A$2:$A$82)-ROW('Cancel Push compiled'!$A$2)+1

This method seems to be less confusing (??).

The posting date of the original thread is almost a year old. What took you
so long the reply? <g>

Biff
 
G

Guest

That still does not work for me. Am I missing something?
I did the key stroke of (CTRL+SHIFT+ENTER) 1ST
Entered the formula
and I get the VALUE error
 
B

Biff

Type the formula then, instead of hitting ENTER like you normally would,
hold down both the CTRL key AND the SHIFT key then hit ENTER. When done
properly Excel will enclose the formula in squihhly braces { }. You can't
just type these braces in, you MUST use the key combination to produce them.

If you're still having problems I'll be glad to look at your file and see if
I can figure it out. Just let me know how to contact you.

Biff
 
G

Guest

That worked...thanks

Biff said:
Type the formula then, instead of hitting ENTER like you normally would,
hold down both the CTRL key AND the SHIFT key then hit ENTER. When done
properly Excel will enclose the formula in squihhly braces { }. You can't
just type these braces in, you MUST use the key combination to produce them.

If you're still having problems I'll be glad to look at your file and see if
I can figure it out. Just let me know how to contact you.

Biff
 
G

Guest

One more question please....

If the fromula:
=INDEX($A2:$H15,SMALL(IF($A$2:$A$15=$A$60,ROW($A$2:$A$15)),ROW(1:1)),5)

can I change $A$2:$A$15=$A$60 to look up a range?
 
B

Biff

=INDEX($A2:$H15,SMALL(IF($A$2:$A$15=$A$60,ROW($A$2:$A$15)),ROW(1:1)),5)

Use this:

=INDEX($A2:$H15,SMALL(IF($A$2:$A$15=$A$60,ROW($A$2:$A$15)-ROW(A$2)+1),ROWS($1:1)),5)
can I change $A$2:$A$15=$A$60 to look up a range?

What do you mean?

Biff
 
G

Guest

I would like to copy down and do this for all the values in the list not just
the value from A60
 
B

Biff

You can do that, however, since the formula returns possible multiple
results for each lookup value you'd have to use another formula (the same
one, just change =$A$60 to the next cell reference).

Biff
 
B

Biff

Why don't you send me your file so I can see what your trying to do!

Let me know how to contact you.

Biff
 
G

Guest

you can email me at (e-mail address removed) this weekend or call my mobile
864-320-5503. I will sent you the file if you send me your email address.
 

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