How to return multiple values using vlookup in excel
The VLOOKUP function is designed to return only the corresponding value of the first instance of a lookup value. But there is a work-around to identify multiple matches. Although VLOOKUP is not used in this array formula, these array formulas are easier to understand and troubleshoot.
Table of Contents
- Return multiple values vertically
- Return multiple values horizontally
- Return multiple records
- Return multiple values vertically or horizontally (vba)
- Lookup across multiple sheets
- Vlookup – Return multiple unique distinct values in excel
Return multiple values vertically

This array formula is entered in cell C8. Then copy cell C8 and paste to cells below.
Array formula in C8:
How to create an array formula
Download excel file
Vlookup.xls
(Excel 97-2003 Workbook *.xls)
Return multiple values horizontally

This array formula is entered in cell C9. Then copy cell C9 and paste to the right.
Array formula in C9:
How to create an array formula
Download excel file
Return multiple values horizontally.xls
Return multiple records

Array formula in cell A10:
Copy cell A10 and paste to cell range A10:C12.
How to create an array formula
Download excel file
Vlookup - return multiple records.xlsx
(Excel 2007 Workbook *.xlsx)
How to create an array formula
- Copy (Ctrl + c) and paste (Ctrl + v) array formula into formula bar.

- Press and hold Ctrl + Shift.
- Press Enter once.
- Release all keys.
How to remove #num errors
Array formula:
Explaining array formula (Return values vertically)
Step 1 - Identify cells equal to the criterion
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
= (equal sign) is a comparison operator and checks if criterion ($B$8) is equal to values in array ($B$2:$B$6). This operator is not case sensitive.
$B$8=$B$2:$B$6
becomes
"Pen"={"Pen"; "Eraser"; "Paper"; "Pen"; "Paper Clip"}
becomes
{"Pen"="Pen"; "Pen"="Eraser"; "Pen"="Paper"; "Pen"="Pen"; "Pen"="Paper Clip"}
becomes
{TRUE; FALSE; FALSE; TRUE; FALSE}
Step 2 - Create array containing row numbers
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1
becomes
{2;3;4;5;6} - MIN({2;3;4;5;6})+1
becomes
{2;3;4;5;6} - 2+1
becomes
{2;3;4;5;6} - 1
becomes
{1;2;3;4;5}
Step 3 - Filter row numbers equal to criterion
=INDEX($C$2:$C$6, SMALL(IF({TRUE;FALSE;FALSE;TRUE;FALSE},{1;2;3;4;5} , ""), ROW(A1)))
becomes
=INDEX($C$2:$C$6, SMALL({1;"";"";4;""}, ROW(A1)))
Step 4 - Return the k-th smallest row number
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)))
SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1))
becomes
SMALL({1;"";"";4;""}, ROW(A1))
This part of the formula returns the k-th smallest number in the array (1,"","",4,"")
To calcualte the k-th smallest value I am using ROW(A1) to create the number 1.
When the formula in cell C8 is copied to cell C9, ROW(A1) changes to ROW(A2). ROW(A2) is 2.
In Cell C8: =INDEX($C$2:$C$6, SMALL((1,"","",4,""), ROW(A1)))
=INDEX($C$2:$C$6, SMALL((1,"","",4,""), 1))
The smallest number in array (1,"","",4,"") is 1.
In Cell C9: =INDEX($C$2:$C$6, SMALL((1,"","",4,""), ROW(A2)))
=INDEX($C$2:$C$6, SMALL((1,"","",4,""), 2))
The second smallest number in array (1,"","",4,"") is 4.
Step 5 - Return value in range
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
In Cell C8:
=INDEX($C$2:$C$6,1)
becomes
=INDEX({1,5;2;1;1,7;3}, 1)
and returns $1,50
In Cell C9:
=INDEX($C$2:$C$6,4) is $1,70
Functions in this article:
VLOOKUP(lookup_value; table_array; col_index_num; [range_lookup])
Looks for a value in the leftmost column of a table, and then returns a value in the same row from a column you specify. By default, the table must be sorted in ascending order.
IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
SMALL(array,k) returns the k-th smallest row number in this data set.
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text
ROW(reference) returns the rownumber of a reference
Return multiple values vertically or horizontally (vba)
Make sure you have copied the vba code below into a standard module before entering the array formula.
=vbaVlookup(lookup_value, table_array, col_index_num, [h])
h is optional, h= return values horizontally
Array formula in cell C9:C11:
Array formula in cell C14:D14:
How to enter custom function array formula
- Select cell range C8:C10
- Type above custom function
- Press and hold Ctrl + Shift
- Press Enter once
- Release all keys
Vba code
- Copy vba code below
- Press Alt + F11
- Insert a module in project explorer

- Paste into code window
- Return to Microsoft Excel
Function vbaVlookup(lookup_value As Range, tbl As Range, col_index_num As Integer, Optional layout As String = "v")
Dim r As Single, Lrow, Lcol As Single, temp() As Variant
ReDim temp(0)
For r = 1 To tbl.Rows.Count
If lookup_value = tbl.Cells(r, 1) Then
temp(UBound(temp)) = tbl.Cells(r, col_index_num)
ReDim Preserve temp(UBound(temp) + 1)
End If
Next r
If layout = "h" Then
Lcol = Range(Application.Caller.Address).Columns.Count
For r = UBound(temp) To Lcol
temp(UBound(temp)) = ""
ReDim Preserve temp(UBound(temp) + 1)
Next r
ReDim Preserve temp(UBound(temp) - 1)
vbaVlookup = temp
Else
Lrow = Range(Application.Caller.Address).Rows.Count
For r = UBound(temp) To Lrow
temp(UBound(temp)) = ""
ReDim Preserve temp(UBound(temp) + 1)
Next r
ReDim Preserve temp(UBound(temp) - 1)
vbaVlookup = Application.Transpose(temp)
End If
End FunctionDownload excel file
Recommended articles
Check out these posts and learn more about vlookup.
- Excel udf: Lookup and return multiple values concatenated into one cell
- Match two criteria and return multiple rows in excel
- Vlookup with 2 or more lookup criteria and return multiple matches in excel
- Using array formula to look up multiple values in a list
- Search for multiple text strings in multiple cells in excel
- Vlookup – Return multiple unique distinct values in excel
- Fuzzy vlookup (excel array formula)
- Lookup using two criteria in excel
- Search case sensitive and return multiple values in excel
- Vlookup a range in excel
- Vlookup with multiple matches returns a different value in excel
- Vlookup of three columns to pull a single record
Related blog posts
- Vlookup – Return multiple unique distinct values in excel
- Vlookup visible data in a table and return multiple values in excel
- Vlookup with 2 or more lookup criteria and return multiple matches in excel
- Vlookup with multiple matches returns a different value in excel
- Lookup a value in a list and return multiple matches in excel








November 13th, 2009 at 8:56 pm
Ok - I absolutely MUST comment on this! I've spent my entire day looking all over the web for help on doing a VLOOKUP to look up one value and return multiple corresponding values and have not found anything that has helped me as much as you have! =D You've made my day. Thank you for posting this!
~kenbra
November 14th, 2009 at 8:56 am
I am happy you found this post, but my advice is to take a look at this post instead: Using array formula to look up multiple values in a list. It has an array formula not as complicated as this one.
Thank you for your comment!
February 10th, 2010 at 5:34 am
Hi. I used this formula and it works great. However I like to know how the formulas I use work. I have spent a lot of time on the internet trying to break it down but this one has me stumped. I understand part, like the VLOOKUP and INDEX but I don't know how the rest fits in. Are you able to break this down for the dummies? If you have time it would be greatly appreciated.
July 15th, 2010 at 6:13 pm
Hi,
Continuing your example, is there a way to "Eraser" and "Paper clip"? and keep goign down? It returns #NUM because Row is set to 3:3 after the two Pen entries. Is there a way to reset the row to ROW(1:1) after a new vlookup search string?
Thanks
July 15th, 2010 at 10:27 pm
Excel User,
I am not sure I understand but I think I covered your question in this post: http://www.get-digital-help.com/2009/12/29/vlookup-with-2-or-more-lookup-criteria-and-return-multiple-matches-in-excel/
September 17th, 2010 at 2:28 pm
Very helpful posts. I tried using the formula above but it didn't work for me and I can't figure out how to adjust it to accomodate my needs. Here is what I have: Data Range is in $E$1:$F$8
Data Range Col. A Col B
Red 2
Green 6
Pink 3
Blue 9
Red 7
Yellow 11
Blue 4
Red 14
September 17th, 2010 at 2:34 pm
Thank you for your very helpful posts. I tried using the formula above but it didn't work for me and I can't figure out how to adjust it to accomodate my needs. Here is what I have: Data Range is in $E$1:$F$8, I would like my results in Col. B. Lookup value in column A and return the value in Col F that matches. Since there are duplicates in Col. A I want Col. B to return the next matching value from col. F. Essentially this is a Vlookup with multiple matches that would return a different value. Thanks for any help you can provide.
Data Range Col. A Col B
Red 2 Red
Green 6 Red
Pink 3 Red
Blue 9 Yellow
Red 7 Blue
Yellow 11 Blue
Blue 4
Red 14
September 19th, 2010 at 9:36 am
Linda,
read this post: Vlookup with multiple matches returns a different value in excel
October 9th, 2010 at 8:57 pm
looking for a formula that will take a part number from one column and go and look for all related vehicle applications per that part number and return the vehicle applications to a single cell related back to the part number
November 9th, 2010 at 11:51 am
HI,
Thanks for the same.
I Tried a lot but i didnt get. i want to know how to use the same.
Please requesting you kindly help me on this.
Regards,
Chandra
November 9th, 2010 at 2:36 pm
Chandra,
Did you download the excel example file?
November 11th, 2010 at 8:30 am
Hi there, I think I understand the logic behind these formula but when I try to amend it it doesn't work. I downloaded the example file.
This formula below works
INDEX(tbl,SMALL(IF($E$8=$B$2:$B$6,ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1,""),ROW(A1)),2)
Originally tbl is referencing B2:C6
I change it so that it is referencing B2:D6
Pen $1.50 Red
Eraser $2.00 Blue
Paper $1.00 Green
Pen $1.70 Yellow
Paper clip $3.00 Black
and then update the formula to
INDEX(tbl,SMALL(IF($E$8=$B$2:$B$6,ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1,""),ROW(A1)),3)
I would expect 'Red' and 'Yellow' to be returned instead of 1.50 and 1.70 but instead the formula will not calculate.
Any suggestions?
November 11th, 2010 at 9:34 am
Ignore last. Realised it was because I hadn't pressed CTRL + SHIFT + ENTER!
Thanks very much for your post. It has really helped me!
November 11th, 2010 at 9:35 am
Ignore last. Realised I hadn't hit CTRL + SHIFT + ENTER!
Thanks for your post. It really helped me.
December 20th, 2010 at 1:36 pm
Richard,
Read this post: Excel udf: Lookup and return multiple values concatenated into one cell
January 4th, 2011 at 7:14 pm
This is just awesome. Thank you. Had to do a big tweek to do a less than if statement. But wow this worked great. Thank you
January 4th, 2011 at 8:58 pm
Joe,
Thanks for your comment!
January 29th, 2011 at 1:54 am
For the life of me I cannot get this to work on my spreadsheet. So frustrating.
January 29th, 2011 at 10:00 am
Jim,
Post your formula here and I´ll see what I can do.
February 15th, 2011 at 2:12 pm
Thanks very much for this help. The information is very well presented and explanied.
I am attemting to do what is described above however rather than actually listing the mutiple values in different cells I just want to add them all together and find the total in one cell. Do you know if this is possible or is there an easy method.
Thanks
Henry
February 15th, 2011 at 9:31 pm
Henry Nichols,
SUMIF(range, critera, [sum_range])
Adds the cells specified by a given condition or criteria.
February 23rd, 2011 at 4:13 pm
HI,
Nice one, just a little mistake
Here is the correct one
=INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW($A$1:$A$6)))
At the end it is not Row(A1), but has to be a vector for an increasing increment.
February 23rd, 2011 at 9:26 pm
cybou,
It is not a mistake, ROW(A1) is a relative cell reference.
Download the example file and check it out.
March 12th, 2011 at 12:23 am
I like this - but would like the #num not to be displayed if the value is not found. Sometimes I have 3 values and at other times may be 5
March 12th, 2011 at 5:21 pm
Elwil,
IFERROR() function filters errors.
March 13th, 2011 at 1:25 am
Just wanted to say thanks, what an awesome bit of excel-ing
March 14th, 2011 at 11:47 am
You are most welcome! Thanks for commenting!
March 18th, 2011 at 5:29 pm
Oscar,
Thanks-- I'm using Excel 2003 and used the VLookup array successfully. However I'm been unsuccessful adding the IFERROR() function to clean up the sheet. Could you provide further explanation on using IFERROR for Excel 2003.
March 21st, 2011 at 8:18 am
IFERROR is a function in excel 2007 and later versions.
Excel 2007
IFERROR(value, value_if_error)
Excel 2003 and earlier versions:
IF(ISERROR(formula), value_if_error, formula)
March 27th, 2011 at 8:59 pm
Hi,
First off thanks for the help ur site is great.
My question is in addition to the formula mentioned is there any way I can get the formula to return unique values only?
For the example above, if Pen had 4 prices ($1.5,$1.7,$1.5 and $1.7) is there a way to get only one 1.5 and 1.7?
I hope my question is clear...
Thanks!
March 27th, 2011 at 9:26 pm
Gi99a,
In my blog post example above, array formula in cell C8:
=INDEX(tbl, SMALL(IF(($B$8=$B$2:$B$6)*(COUNTIF($C$7:C7, $C$2:$C$6)=0), ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), ROW(A1)), 2) + CTRL + SHIFT + ENTER.
March 28th, 2011 at 1:03 am
Hey,
Thanks for ur reply.
However this still gives me all values of "pen" so cell C8 onwards would give me repeated values for pen if there are any in "tbl"...
March 28th, 2011 at 7:37 am
Gi99a
Download example file
May 8th, 2011 at 11:02 am
Thank you for this, it was really helpful.
May 9th, 2011 at 7:34 am
ErikB,
Thanks for your comment, I appreciate it!
May 12th, 2011 at 4:21 pm
How to return multiple values using vlookup in excel and removing duplicates?
my sheet is setup as follows
A B C D E
1 Section Category item flavor size
2 food Coffee Espresso none Single
3 food Coffee Espresso none double
4 food Coffee Americano none Single
5 food Coffee Americano none double
i have tried the formula to return multiple values using the index example and worked fine with none duplicate item but how can i list them without the duplicate?
appreciate your help
May 13th, 2011 at 12:21 pm
Ahmed Ali,
Read this post: Vlookup – Return multiple unique distinct values in excel
May 30th, 2011 at 9:15 am
Hey there, I'd just like to drop a bomb of thanks, this helped reduce my fear of ARRAY formulas man. This post was a BIG help!
May 30th, 2011 at 2:19 pm
Dear Oscar,
First of all thank you for sharing your expertise in excel. I am one who benefited from all your comments and formula here. I have some difficulties though from the below formula. Basically I'm using xcelsius 2008, and the problem is ROW function is not recognize by xcelsius, can please help me with the same concept of the below formula without using the row function? I'm using the below formula because i want the multiple results using vlookup. please help. Thanks
Marlon
=VLOOKUP($Y$1, INDEX($AA$38:$AO$51, SMALL(IF($Y$1=INDEX($AA$38:$AO$51, , 1), ROW($AA$38:$AO$51)-MIN(ROW($AA$38:$AO$51))+1, ""), ROW(7:7)), , 1), $AB$36, FALSE)
May 31st, 2011 at 2:22 pm
Marlon,
Sorry, I have no knowledge about xcelsius 2008.
June 21st, 2011 at 2:58 pm
Duuuude, you have no idea how helpful this was
June 22nd, 2011 at 8:58 am
Munir,
thanks!
June 30th, 2011 at 7:14 pm
Hi Oscar,
I am trying to implement this formual in my spreadsheet but it is just returning the first row and the rest of the rows are #num.
I have data in A2:B602. I entered the name to look up in cell c2. I want it to return all the data corresponding to that name in column D. Could you please suggest some work around or why the formula is not working
=INDEX($B$2:$B$602,SMALL(IF(($C$2=$A$2:$A$602),ROW($A$2:$A$602)-MIN(ROW($A$2:$A$602))+1,""),ROW(A2)))
Thanks
June 30th, 2011 at 7:35 pm
Ramya,
A minor change to your formula.
How to create an array formula

Copy (Ctrl + c) and paste (Ctrl + v) array formula into formula bar.
Press and hold Ctrl + Shift.
Press Enter once.
Release all keys.
How to copy formula in cell D2
Select cell D2
Copy (Ctrl + c)
Select cell range D2:D10
Paste (Ctrl + v)
(Extend formula further down if range D2:D10 is too small)
June 30th, 2011 at 7:49 pm
This is really great! Thank you so much!
I had another question for you though. Would it be possible to get the output in a row??
For instance I want the results to be displayed on Row A rather than column D?
Thanks again
June 30th, 2011 at 9:44 pm
Ramya,
Array formula in cell A1:
Copy cell A1 and paste to A1:A10
July 6th, 2011 at 1:07 pm
Really brill.....not very good at excel, but find this function amazing.
One question, instead of searching for words (such as pen, or eraser), how can i get it to search for a number - such as 124356.
Help much appreciated.
Matt
July 6th, 2011 at 2:17 pm
Sorry to bother you again...just wondering - how do i use the IFERROR function with this formula?
I need to add all the results of the above formula, but can not do so when it returns a #NUM value!
Thanks,
Matt
July 6th, 2011 at 2:20 pm
Matt Lyons,
The formula works for numbers also.
Example,
Array formula in cell C10:
How to create an array formula
Copy (Ctrl + c) and paste (Ctrl + v) array formula into formula bar.
Press and hold Ctrl + Shift.
Press Enter once.
Release all keys.
July 6th, 2011 at 2:24 pm
I Have figured out the iferror one, sorry.
Matt
July 6th, 2011 at 2:33 pm
thanks Oscar,
But i still can not get it to work for my numbers. example, table something like 12347 $1.70 , and looking to return the value $1.70, when it finds 12347, but just returns a #NUM
Matt
July 6th, 2011 at 2:40 pm
Sorry Oscar...i have it
thanks a million.
matt
July 6th, 2011 at 3:32 pm
Oscar,
Very sorry to bother you again, but on using this formula, along with the iferror function, i find that if the number i am looking for appears only once in the list - it returns a "0" value.
This is the formula i am using:
{=IFERROR(INDEX($B$1:$D$84,SMALL(IF(($B99=$B$1:$B$84),ROW($B$1:$B$84)-MIN(ROW($B$1:$B$84))+1,""),COLUMN(B11)),2),"0"}
Have you any idea why it is doing so?
regards,
Matt
July 6th, 2011 at 3:45 pm
Matt Lyons,
The bolded cell reference is a relative cell reference. It must have a cell reference to column A. When the formula is copied, the relative cell reference changes. Your formula has to be copied horisontally.
Array Formula:
How to create an array formula
Copy (Ctrl + c) and paste (Ctrl + v) array formula into formula bar.
Press and hold Ctrl + Shift.
Press Enter once.
Release all keys.
July 6th, 2011 at 5:20 pm
Thanks Carlos
So, would i be right in saying - when i copy my formula Horizontally,it needs to go from COLUMN(A1) to COLUMN(B1))to COLUMN(C1))etc? is this correct?
Matt
July 6th, 2011 at 5:20 pm
Sorry, I mean Oscar!!! its been a long day at EXCEL!!
July 7th, 2011 at 8:22 am
Matt Lyons,
Yes, that is correct.
How to copy array formula
Select cell
Copy (Ctrl + c)
Select cell or cells to the right
Paste (Ctrl + v)
A relative cell reference changes automatically when the cell is copied.
July 7th, 2011 at 4:52 pm
Hi Oscar,
Did you write these guides? Just wanted to say they are pretty awesome. It is good that you are still hanging around after 2 years since it was published to help others.
Thanks!
Dan
July 8th, 2011 at 7:08 am
Daniel,
Yes, I wrote these guides. Thank you and thanks for commenting!!
July 9th, 2011 at 10:37 pm
Hello,
So, I tried using this formula, but I think I ran into a problem. I have one table with text strings in it. From another table I want to find the rows that match with this text string from the first table and display that, but occasionally there are multiple rows in the second table that have this text string, and I want to see all the outcomes per text string. It seems to work similar to what you do here, but then my search is with text strings, and therefore the SMALL function does not seem to work. I looked at the other page on working with text strings, but the application I am working on is not the one displayed there, but the one displayed here. Can you help me to make this work?
Jessica
July 11th, 2011 at 4:09 pm
great job. i got mine working perfectly Oscar - thanks a million .
I was wondering, do you know how i can move 2 excel sheets to a different folder , without upsetting the formulas which are used linking both sheets ? (ie: each sheet uses the other sheet to extract data, but when you move them , neither work?)
Matt
July 11th, 2011 at 5:37 pm
Jessica,
The array formula on this page works with both numbers and text. If I understood your question, the array formula should do the job.
Try to explain in greater detail or send your workbook.
July 11th, 2011 at 5:47 pm
Matt Lyons,
I found this: Mass changing Excel links??
I have not tried it.
July 13th, 2011 at 2:33 pm
I am trying to look up multiple rows at one time. What formula do I use?
July 14th, 2011 at 12:40 pm
T.C,
I have changed this post,I hope you will find the answer more easily now. If not, explain your problem in greater detail and I will try to find or create the formula.
July 24th, 2011 at 7:55 am
Hi oscar,
Please help me. What formula of vlookup i used to look up more value in another sheet if ever i enter id no.
Ex.Sheet 1
Id no Name Age
123 kia 30
234 ana 45
123 liza 65
879 meg 34
435 greg 13
I like this output in Sheet 2;
Id:______(if ever i choose 123)
output:Id no Name Age
123 kia 30
123 liza 65
thank you
July 24th, 2011 at 2:57 pm
anna,
read arnelias question
July 25th, 2011 at 3:01 pm
Thank you so much Oscar
July 25th, 2011 at 3:57 pm
Hi ocscar,
I try the formula you give to arnelia, but It does not work. Please help me. Please.. Send me a excel format please
thank you
July 26th, 2011 at 8:37 am
anna,
Download excel file
Vlookup - return multiple records.xlsx
(Excel 2007 Workbook *.xlsx)
July 26th, 2011 at 1:37 pm
Hi Oscar,
Thank you so much....This is really great.
July 27th, 2011 at 9:51 pm
Tried using your formula on my project but am having some difficulties. First off had to change the "" to zero to get it to display a value, but now when it searches the price list it displays the first entry even though it doesn't match. It also won't display on the other cells when I copy and paste. If you can help in anyway I would greatly appreciate it.
=INDEX('Price List'!$A$3:$C$57000, SMALL(IF('Price Sheet'!$B$4='Price List'!$A$3:$A$57000, ROW('Price List'!$A$3:$A$57000)-MIN(ROW('Price List'!$A$3:$A$57000))+1, 0), ROW(A1)),COLUMN(A1))
July 28th, 2011 at 8:55 am
BPV,
1, You can´t change "" to 0, then the formula returns the first record in your pricelist.
2, I am guessing here.. Maybe the value in 'Price Sheet'!$B$4 contains an additional space somewhere? Compare the values.
July 28th, 2011 at 3:18 pm
Hi oscar,
Thank you so much for help. But i notice the sample you send me, the database and output in one one sheet only, i try to separate the database and output using this formula:
=INDEX($A$2:$C$7, SMALL(IF($B$9=$A$2:$A$7, ROW($A$2:$A$7)-MIN(ROW($A$2:$A$7))+1, ""), ROW(A1)),COLUMN(A1)
But It does not work again. Please help me. Kindly send me again the excel sample that the output & database in separate sheet please please....Thank you
July 29th, 2011 at 10:02 am
anna,
Download excel file
Vlookup - return multiple records.xlsx
(Excel 2007 Workbook *.xlsx)
July 29th, 2011 at 12:36 pm
1, You can´t change "" to 0, then the formula returns the first record in your pricelist.
2, I am guessing here.. Maybe the value in 'Price Sheet'!$B$4 contains an additional space somewhere? Compare the values
If I leave the "" in the formula I only returns a #VALUE!. I double checked and there is no additional spaces in the cell. Still not quite sure what the problem is.
July 29th, 2011 at 1:14 pm
Hi
This guide has gone directly to the top of my favorites. I've been loogin for this for so long!
But I still have a question.
I use this formula to put in all overdue invoices for my customers in a payment reminder letter.
So sometimes it is 1 invoice and sometimes it is 20 invoices or more.
Below the rows, where I am using your formula, I need to put in some plain text, but right now I has te be ind the very bottom of the page, and it doesn't look good when only one line is returned from the formula. Though it does look good when it is several rows.
Have you got any tips on how to make the area with formula flexible in how many rows it "occupies".
July 29th, 2011 at 1:50 pm
Hi Oscar....
THANK YOU SO MUCH.....
July 29th, 2011 at 4:41 pm
Hi,
is it possible to have the results in the same cell using a variation of your formula?..
I mean like:
John | x22 | John,Mark
John | x23 | John
John | x24 | John, George
Mark | x22 | John, Mark
George|x24 | John, George
The results separated by the comma in a single cell?...
And thanks a lot for your usefull code...
July 30th, 2011 at 8:03 am
mcholst,
It is hard for me to give you advice without having seen your sheet.
anna,
you are welcome!
Ivan,
I believe this post describes what you are asking for: Excel udf: Lookup and return multiple values concatenated into one cell
VBA code:

July 30th, 2011 at 11:43 am
Hello,
thank you for your fast reply...
I'm not very good in excel and udf, anyway i followed your adivice, took your code and recreate a module.
The strange thing is that it gives me a blank cell (I took off the name of the sheet cause i want the results in the same one where the data are)..
Did i miss something?
July 31st, 2011 at 10:35 am
Ivan,
Download excel file
Lookup and return multiple values concatenated into one cell.xls
(Excel 97-2003 Workbook *.xls)
August 3rd, 2011 at 10:39 am
thank you a lot..
It works perfectly
August 19th, 2011 at 12:58 pm
Ok, in excel I want to lookup the value of column B where the value in column F equals "1" exactly. I then want to add up the value in B for each match until the table column F8:F202 has been checked for matches :
For example
Col B ----- Col F
10 ----- 1
1 ----- 1
0 ----- 0
1 ----- 10
2 ----- 1
I would expect the formula to return 13, due to "10 x 1", "1 x 1" and "2 x 1" matching = 10 + 1 + 2 = 13
To me, the formula should contain a LOOKUP and SUMIF statement.
I've tried several formulaes, but without joy. Your help would be appreciated.
August 22nd, 2011 at 10:14 am
Sean,
August 27th, 2011 at 3:23 pm
Hi oscar,
It possible can use vlookup only and will not use the index to get the output on this:
Sheet1
id name status
123 ANNA active
124 jhun separated
125 liza active
129 roy separated
789 mary separated
123 anna separated
Sheet2:
Enter id:123
123 ANNA active
123 anna separated
August 28th, 2011 at 4:08 pm
Hi Oscar,
Do you know whats wrong in my formula?
=INDEX(deletion,SMALL(IF($A$7=DELETION!$B$3:$B$500,ROW(DELETION!$B$3:$B$500)-MIN(ROW(DELETION!$B$3:$B$500))+1,""),ROW(B11)),COLUMN(B11)
Thank you.....
August 28th, 2011 at 5:14 pm
ANA,
Question 1
Sorry, I don´t know how.
Question 2
=INDEX(deletion,SMALL(IF($A$7=DELETION!$B$3:$B$500,ROW(DELETION!$B$3:$B$500)-MIN(ROW(DELETION!$B$3:$B$500))+1,""),ROW(A1),COLUMN(A1))
The cell references in column and row functions always start with A1.
August 29th, 2011 at 3:20 am
hi Oscar
Thank you so much for your help. One question again if ever my output like this and i would like to hide #num. What formula i can used?
Enter id:123
123 ANNA active
123 anna separated
#num #num #num
Here's my use formula.
=INDEX(deletion,SMALL(IF($A$7=DELETION!$B$1:$B$499,ROW(DELETION!$B$1:$B$499)-MIN(ROW(DELETION!$B$1:$B$499))+1,""),ROW(B1)),COLUMN(B1))
Thank you in advance
August 29th, 2011 at 8:14 am
ANA,
Excel 2007:
Excel 2003:
August 29th, 2011 at 9:15 am
Hi Oscar,
THANK YOU SO MUCH.......
August 30th, 2011 at 12:34 pm
Oscar,
Only just got an email saying there is a reply.
Tried the formulae out and it worked a treat.
Is there a particular book on excel that would be an ideal guide on some of the questions you are asked, or is it a case of trial and error ?
Very much appreciated.
Séan
August 30th, 2011 at 12:45 pm
Oscar,
Now for another puzzle. I have a datasheet which I produce several pivot tables on worksheets within the excel document. One column is a hyperlink to an internal website :
http://companyweb/Lists/Sales%20Product%20Information/DispForm.aspx?ID=1
This is kept on a worksheet called "Pivot Data". To update this data, I cut and paste the values over the top of the current data, so on effect, the number of rows will vary.
Is there a way of making this cell automatically recognises the hyperlink and updates accordingly ?
When you refresh the data, so that each of the pivot tables are updated with the new data, is it then possible to make sure that the data of the hyperlink is shown as a valid hyperlink which can be clicked on and redirected., i.e. The worksheet "Customer Sales" is a pivot table based on the "Pivot Data" worksheet and the column title for the hyperlink data is "Notes".
I know I'm asking a bit much, but I'm sure there is a solution and at the moment I'm struggling to find one.
Regards
Séan
August 31st, 2011 at 12:01 am
Hi Oscar,
First time here so please bear with me. I've searched just about everywhere for a formula that can help me. I'm using the
=INDEX($A$2:$C$7, SMALL(IF($B$9=$A$2:$A$7, ROW($A$2:$A$7)-MIN(ROW($A$2:$A$7))+1, ""), ROW(A1)),COLUMN(A1))
formula to return multiple records. I have tried to modify it but to no avail. Where your formula matches the cell in $B$9 exactly, I would want to simply put part of the value in $B$9 and let the formula return all that match it e.g. you use 123 and it shows you all the 123 and adjacent values but I would want to enter e.g. only 12 and would want it to return all values that contain 12.
The above is basically to be used to look for product codes. I have an array of 4 columns with product codes in 1st column and need e.g. all products starting with "CP-" and also displaying all adjacent values that come with the particular product code. Not sure if I'm being clear enough.
example:
product code...column2...column3...column4
MB-DKJ3475.....1122......N.........product description
CH-UYI2938.....125.......N.........product description
CP-DLK4378.....4258......C.........product description
CC-DDD3429.....26553.....C.........product description
CP-LKL4344.....33........C.........product description
I would want all the product lines starting with "CP-":
CP-DLK4378.....4258......C.........product description
CP-LKL4344.....33........C.........product description
Greatfull for any help that you might be able to provide.
Many thanks in advance
Regards
Coenraad
August 31st, 2011 at 8:00 am
Sean,
Is there a particular book on excel that would be an ideal guide on some of the questions you are asked, or is it a case of trial and error ?
As far as I know, there is not much written about array formulas.
I got interested in array formulas when I discovered Dennis Wallentin website: http://xldennis.se/ . It is in swedish.
I am inspired by comments on my website, other forums and excel sites.
There is also a lot of trial and error.
August 31st, 2011 at 8:30 am
Sean,
Now for another puzzle. I have a datasheet which I produce several pivot tables on worksheets within the excel document. One column is a hyperlink to an internal website :
http://companyweb/Lists/Sales%20Product%20Information/DispForm.aspx?ID=1
This is kept on a worksheet called "Pivot Data". To update this data, I cut and paste the values over the top of the current data, so on effect, the number of rows will vary.
Is there a way of making this cell automatically recognises the hyperlink and updates accordingly ?
Yes, import data from the web using web queries.
Here are some resources:
http://office.microsoft.com/en-us/excel-help/get-and-analyze-data-from-the-web-in-excel-HA001054848.aspx
http://www.openjason.com/2008/01/25/3-steps-to-scrape-the-web-with-microsoft-excel/
http://www.vertex42.com/News/excel-web-query.html
How to recognize url in sheet1 cell A1
Function Identifyaddress() As Boolean If Sheets("Sheet1").Range("A1").Value = "http://companyweb/Lists/Sales%20Product%20Information/DispForm.aspx?ID=1" Then Identifyaddress = True Else Identifyaddress = False End If End FunctionWhen you refresh the data, so that each of the pivot tables are updated with the new data,
Sure, use tables. They are dynamic. You need vba to refresh pivot tables automatically: Auto refresh a pivot table in excel
is it then possible to make sure that the data of the hyperlink is shown as a valid hyperlink which can be clicked on and redirected.,
You need a macro to accomplish this.
i.e. The worksheet "Customer Sales" is a pivot table based on the "Pivot Data" worksheet and the column title for the hyperlink data is "Notes".
August 31st, 2011 at 8:52 am
Coenraad,
I believe you are looking for this post:
Lookup with multiple criteria and display multiple search results using excel formula
Array formula in cell A10
Cell $A$8 contains the search value.
How to create an array formula
Copy (Ctrl + c) and paste (Ctrl + v) array formula into formula bar.
Press and hold Ctrl + Shift.
Press Enter once.
Release all keys.
How to copy array formula
Select cell A10
Copy (Ctrl + c)
Select cell range A10:D12
Paste (Ctrl + v)
August 31st, 2011 at 8:55 am
Oscar,
I'll look into. Thanks again.
What if the ID changes, and may not be the same in each cell ?
http://companyweb/Lists/Sales%20Product%20Information/DispForm.aspx?ID=1
or
http://companyweb/Lists/Sales%20Product%20Information/DispForm.aspx?ID=2
or
http://companyweb/Lists/Sales%20Product%20Information/DispForm.aspx?ID=....
August 31st, 2011 at 11:57 am
Oscar,
Thanks a mil for that. Works perfectly. You saved me a major headache.
Thanks again and have a great day.
August 31st, 2011 at 12:45 pm
Oscar,
I think I have probably confused the issue. The data is on a worksheet within the document containing the pivot tables on other worksheets.
None of the data comes from the web, just that one column of the data may include the hyperlink provided ( "?ID=x" where x is a varaible ).
Basically, when I do a refresh of the data in the "pivotdata" worksheet, I need it to recognise the cell is a hyperlink. In addition, when I update the indivital pivot tables, it looks at the data in the "Notes" field and recognise it as a hyperlink.
Where do I put the "Function Identifyaddress()" information you gave.
Regards
Sean
August 31st, 2011 at 10:58 pm
Hi Oscar,
First, this formula is genius. And now that I buttered you up, here's my question. I wanted to use this but to have the data on another worksheet. So I:
=INDEX(Masterdata, SMALL(IF($B$2=colrow, ROW(colrow)-MIN(ROW(colrow))+1, ""), ROW(Master!B2)),COLUMN(Master!B2))
This works until I drag the formula down to include additional results and Master!B2 becomes Master!B3. At that point, I get a Number error.
I guess I would like to know why the number error occurs, but more importantly, if there is an error free way to use this formula to return data on another worksheet.
Thanks a mil.
KJ
September 2nd, 2011 at 12:14 pm
Sean,
I am confused, it is difficult for me to understand without the workbook.
KJ,
The number error occurs because there are no matching cells left in formula.
Your formula must start with cell reference A1. Bolded in formula below.
Example,
Excel 2007, remove #num errors:
September 3rd, 2011 at 1:16 am
Oscar,
Thanks so much. Worked like a charm.
September 7th, 2011 at 11:52 am
Hi, Thanks for valuable home page,
I want formula to find 2 valuse for the same ID, if I have long list with over 1000 ID's and want to find Anna and the status if she is active or not. How I should write my formula.
Thanks and have a great day.
September 16th, 2011 at 12:28 pm
Oscar,
Did you receive the workbook I emailed you ? If so, any joy with finding a solution to my problem ?
September 16th, 2011 at 1:10 pm
Sean,
Basically, when I do a refresh of the data in the "pivotdata" worksheet, I need it to recognise the cell is a hyperlink. In addition, when I update the indivital pivot tables, it looks at the data in the "Notes" field and recognise it as a hyperlink.
I am still confused. You want the data in column "Notes" being recognized as a hyperlink in a pivot table? So you can click an hyperlink a pivot table and it automatically opens a webpage in a webbrowser?
September 16th, 2011 at 1:14 pm
Correct on both counts. Does this sound feasible ?
Your help is very much appreciated.
Regards
Sean
September 18th, 2011 at 6:56 am
Sean,
USING HYPERLINKS
Unlike external data ranges, active hyperlinks are not supported in PivotTable cells. The hyperlink is treated as text, but you cannot follow the hyperlink to a Web page or document, in Excel or Excel Services.
Source: Use a PivotTable report to make external table data available in Excel Services
September 19th, 2011 at 8:56 am
Oh well
thanks for trying.
Kind Regards
Sean
September 21st, 2011 at 11:54 am
thanks,
it really work for me...
now, i can make my accounting book more light
September 22nd, 2011 at 4:13 pm
Hi I am using your formula where the data is in another tab but it does not seem to work for me.
=INDEX(Activities,SMALL(IF($B$3=NameID, ROW(NameID)-MIN(ROW(NameID))+1, ""), ROW(Data!C2)),COLUMN(Data!C2))
Activites = Data!C2:G27
NameID = Data!C2:C27
I am trying to return the same way as your example INDEX($A$2:$C$7, SMALL(IF($B$9=$A$2:$A$7, ROW($A$2:$A$7)-MIN(ROW($A$2:$A$7))+1, ""), ROW(A1)),COLUMN(A1))
Can you let me know what I am doign wrong?
Thanks
September 22nd, 2011 at 4:20 pm
This is great. Thanks a lot for posting this. You've saved me a bunch of time.
Is it possible to use this to grab data from multiple sheets at once? I see how KJ has pointed it at a single different sheet, above, but my data is spread over 31 sheets all using the same template.
Thanks again.
September 22nd, 2011 at 9:25 pm
I did not read the KJ post above. I changed to A1 and it worked just fine. Thanks again for showing the formula
September 29th, 2011 at 8:48 pm
Sean,
See this post: Follow hyperlinks in a pivot table
October 1st, 2011 at 2:06 pm
Andrew,
No, I have no idea how to accomplish that with array formulas.
October 5th, 2011 at 1:20 pm
Hi Oscar.
Your posts are really helpful and informative - and much appreciated. I have, however, got totally stuck with my example.
I have the following lookup values:
pen
eraser
paper
paper clip
and the following item list:
Allan's pen
eraser
Frances' eraser
Jenny's pen
paper
paper clip
pen
red pen
What I’d like to do is search for each lookup value in the item list and return all the items that contain that text string. For example, 'pen' would return (in adjacent cells):
Allan’s pen Jenny’s pen pen red pen
I have spent several days trying to tweak your examples, to no avail. Can you help or point me in the right direction, please? Many thanks.
October 14th, 2011 at 4:33 pm
Oscar,
I lifted your example verbatium and updated it for my 83 records. The if statement hangs on #value!. I moved it from below the data (row)and placed it in the first available column. The if statement works, but only on the respective row. Thus will not pick up the mutliple's?
Where'd I go wrong?
Thank you
October 16th, 2011 at 5:31 am
You have got one hell of a great method of doing this. I had a found a similar solution some time ago, but that used a VBA custom formula to return arrays. This is better because there is no VBA. Thank you.
However, one big problem: Arrays take a very long time in calculating. I do not know why, but I had to find a solution. Turns out that making each cell an array is the wrong way of doing things.
I will give you my example:
I have a log of material receipts;
I have several sheets in excel that retrieves a list of receipts corresponding to a certain type;
The log has details of each receipt, e.g. date, reciept #, store, delivery type, qty, cost.
If I have say 60 types of materials and at least 30 rows on each sheet with 6 columns, I will have 10800 arrays. That is about 30 seconds of calculation. Far too many for practicality. So I made one array per sheet and I modified the formula so that the last two functions (row and col) have arrays as arguments. Much simpler then. But requires a little more explanation.
Thanks.
October 16th, 2011 at 5:34 am
If I was not clear enough: Each sheet fetches receipts of a certain type from the log.
October 16th, 2011 at 11:43 pm
Help,
Completely perplexed. I can't alter the formula at all without getting the #value! error. What's wrong? I can insert into your example "tbl" but no alteration or edit or open or the formula without the #value!. Any suggestions would be nice?
October 17th, 2011 at 9:40 am
RE,
Oscar,
I lifted your example verbatium and updated it for my 83 records. The if statement hangs on #value!. I moved it from below the data (row)and placed it in the first available column. The if statement works, but only on the respective row. Thus will not pick up the mutliple's?
Where'd I go wrong?
Thank you
Completely perplexed. I can't alter the formula at all without getting the #value! error. What's wrong? I can insert into your example "tbl" but no alteration or edit or open or the formula without the #value!. Any suggestions would be nice?
Suggestions:
Did you change cell references in the formula? Cell references are bolded:
The first formula must start with cell reference A1 (bolded), example:
Did you create an array formula?
October 17th, 2011 at 9:46 am
Anas Hashmi,
Yes, you are right. Array formulas are too slow with large data sets.
October 17th, 2011 at 1:49 pm
Ok,ok...The Control, Shift, Enter thing I completely missed. After editing the formula you must re-enter formula via this key combination. As expected the formula is genius... 4 days later!
So thank you and can you now point me in the right direction. I have a column of cities (multiple), each city row has a color, red, green, blue, etc.. associated with it. The row and column formula works, but grows my data base in rows. I have my colors in columns and want to populate the color column as it applies to the city on a single row basis. The column formula works well, but I can't be assured that all colors will show up in their respective columns with in the city row.
Thus red green, blue, its possible that if green is not in the data, blue data falls into the green column.
Suggestions?
Any advise how to sort on city, and populate columns that apply to specific colors?
October 18th, 2011 at 10:05 am
RE,
I am not sure I understand.
Download excel file
re-city-color.xlsx
October 18th, 2011 at 10:32 pm
From my comma delimited file dump:
Office# City Color Code ID
OF175 Ames Blue 672
OF175 Ames Red 8732
OF25 Oakmont Green 753
OF25 Oakmont Blue 8743
OF5 Omaha Red 634
OF95 Dallas Red 231
OF95 Dallas Blue 13244
OF95 Dallas Orange 13132
OF95 Dallas Pink 234
My Spreadsheet desired result
Office# City State Red Green Blue Orange
OF175 Ames Ia 8732 672
OF25 Oakmont Mn 753 8743
OF5 Omaha Ne 634
OF95 Dallas Tx 231 13244 13132
I'm trying to get from comma delimited rows to a consolidated row where the color code lines up and populates the cell with the ID.
Thank you for your time
Does this help?
October 18th, 2011 at 10:37 pm
Sorry it lost the formatting when I sent it,
CSV: Office# | City | Color |ID |
Excel: Office# | City | State | Red | Green | Blue | Orange
October 23rd, 2011 at 8:54 pm
Oscar,
I guess it can't be done? Eh?
October 23rd, 2011 at 9:14 pm
Re,
I am sorry, I somehow missed your comment.
Check out this file: re-city-color1.xlsx
November 2nd, 2011 at 7:05 pm
Hi, Oscar...
I have been looking for help on "How to return multiple values using vlookup in excel" for one whole day... then I found this... Man!, you help me so much. Thanks for sharing your knowledge. God Bless
November 3rd, 2011 at 9:54 am
Erwin,
Thanks!
November 10th, 2011 at 10:59 pm
Hello,
Thanks for the helpful formula. I used this formula successfully, but now I wanted to get the data I missed with the formula. How would you add multiple IF/AND statements to the formula. For example add:
(IF($B$8<$B$2:$B$6,...),($C$8<$C$2:$C$6,...), etc.
Thanks!
November 11th, 2011 at 8:49 am
Kevin,
I used this formula successfully, but now I wanted to get the data I missed with the formula.
What are you trying to do?
How would you add multiple IF/AND statements to the formula. For example add:
(IF($B$8< $B$2:$B$6,...),($C$8<$C$2:$C$6,...), etc.
November 11th, 2011 at 6:50 pm
Oscar, great post. One question: I am using the vba code you provided and it works great. I am dealing with a set of 110,000+ rows of data (2 columns) with about 17,500 unique lookup values and the remainder of the rows are unique values to be found. I need to use the vba that you posted but to have it output the data horizontally, not a vertical array. I am terrible with VBA. Any chance you could give me some pointers or tell me which part of the code to change. Any help would be much appreciated.
Ex:
35007000030002 354CSTRL
35007000030002 354CSTRU
35007000030002 402MRRW
35007000030003 404CHRK
35007000040000 402MRRW
Needs to become:
35007000030002 354CSTRL 354CSTRU 402MRRW
35007000030003 404CHRK
35007000040000 402MRRW
When looked up.
November 11th, 2011 at 10:47 pm
Sorry, my question was vague. Here is the setup of my worksheet:
I have 3 columns filled with percentages associated with W,X,Y,Z.
% red %pink % blue
10% 15% 30% W
25% 33% 80% X
40% 12% 66% Y
75% 4% 12% Z
I used your formula to find W,X,Y,Z meeting the below criteria:
>30% red >20% pink >50% blue
Y X X
Z Y
Now, I want to find one formula that will find the values not captured by the previous formulas. In other words, (% red <30%)(% pink <20%)( % blue <50%) = W
Thanks!
November 14th, 2011 at 11:24 am
Jonathan ,
I have changed the existing udf on this webpage. It is now possible to return values horizontally.
November 14th, 2011 at 2:17 pm
Kevin,
Download file:
Vlookup-kevin.xls
November 16th, 2011 at 4:19 pm
Oscar, great job! keeping the thread alive for so long! This is a great one!
I have a question around merged cells. Lets say in your first example, Both Pen and Paper cost $5, so I have merged C2 and C3 into a single cell with the $5.
Now, in the search cell (B8), if I put in Pen, it will give me the correct asnwer. However, if I put in Paper it will not return the value, as opposed to the expected returned value of $5.
The question: is there a way to make this work with merged cells
Greatly appreciate you help.
Hass
November 21st, 2011 at 5:24 pm
Hass,
There is question I don´t know the answer to!
I would avoid merged cells as much as possible.
November 23rd, 2011 at 12:13 am
Hi Oscar,
The VLOOKUP "Return multiple values horizontally" is exactly what I need, however it is not working for me. I copied everything exactly as shown in your example, but all I get is "#VALUE!". I am using Excel 2010 on a PC. Has something changed in the 2010 version, or am I just missing something?
November 23rd, 2011 at 7:43 am
would it be possible for the formula to copy itself into other cells below depending on how amny unique references were found in the table?
November 25th, 2011 at 1:37 pm
Kieran,
That would require vba.
November 25th, 2011 at 1:38 pm
Janet,
Maybe you forgot to create an array formula? Instructions are in the post above.
November 28th, 2011 at 3:41 pm
Hi Oscar,
The array formula I used was the same as in your "Return Multiple Values Horizontally" example: "=INDEX($C$2:$C$6, SMALL(IF($B$9=$B$2:$B$6, ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1, ""), COLUMN(A1)))". I set up the table exactly as you show in your example as well, but it isn't working for me. All I get in cell C9 is #VALUE! Any ideas on why it isn't working?
Thanks.
November 30th, 2011 at 3:56 pm
Janet,
Download excel example file:
Return-multiple-values-horizontally.xls
December 1st, 2011 at 5:05 pm
I am trying to use the formula for a bigger range, C3:C40. I modified the formula as follows -
=INDEX('Resource Project Mapping'!C3:C40,SMALL(IF($B$4='Resource Project Mapping'!B3:B40,ROW('Resource Project Mapping'!B3:B40)-MIN(ROW('Resource Project Mapping'!B3:B40))+1,""),ROW('Resource Project Mapping'!A1)))
however I am getting the below results
#VALUE!
#NUM!
#NUM!
#NUM!
#NUM!
Can you please help?
December 5th, 2011 at 10:44 am
DP,
You need to use absolute cell references (except the last cell reference):
December 18th, 2011 at 2:52 pm
Dear,
I want to copy the formula from first cell to its adjacent cells, but I want to keep the same value of the last cell to be multiplied with the above percentage, but when I paste the formula into adjacent cell it copies the value of the cell next to the one I need the value from
please advise
December 19th, 2011 at 8:55 pm
Hi Oscar,
I'm trying to use your vbaVlookup tool, and am having issues where by lookup columns are backwards from yours (switch the price and pen columns around), and I want to find all of the matches from the first column, not the second one. When I use the formula, it just returns a blank. It works fine if I switch the columns, but this is not ideal.
Here's an example:
A B
AAA GrpA
BBB GrpA
CCC GrpB
DDD GrpA
EEE GrpC
I then create another column elsewhere, with "GrpA" as a header, then in the second row of that column, my function looks like this:
{=vbaVlookup(C1,$A$2:$B$15,1)}
I figured the last parameter (1) was to look at the first column instead of the second.
If you could provide some help to get this working, that would be superb. Thanks!
December 23rd, 2011 at 12:54 pm
Feras,
Can you describe in greater detail and some example values?
December 23rd, 2011 at 3:22 pm
Ben,
download file:
Ben.xls
January 11th, 2012 at 10:19 am
Oscar,
Is it possible to return the values in the next tab or sheet? instead of the same sheet?
January 11th, 2012 at 12:06 pm
Oscar, Pls ignore above.
I got how to do
January 12th, 2012 at 5:24 pm
Hi Oscar,
Thanks for this article... the formula has been a great help to me in setting up some of my worksheets. I have a question about it though:
=INDEX($A$2:$C$7, SMALL(IF($B$9=$A$2:$A$7, ROW($A$2:$A$7)-MIN(ROW($A$2:$A$7))+1, ""), ROW(A1))
Is it necessary to use the "MIN(ROW(array))+1" calculation? I was looking at a similar formula posted by Ashish Mathur and I noticed he didn't use the "MIN...".
Thanks
January 13th, 2012 at 1:23 pm
Timus,
You can also use MATCH(ROW($A$2:$A$7), ROW($A$2:$A$7)).
becomes
In fact, you can use: ROW($1:$7)
and the formula becomes:
Remember, if you then replace your cell references with named ranges, the last formula won´t work. It is not dynamic contrary to the other two formulas.
Thanks for commenting!
January 17th, 2012 at 3:34 am
Hi Oscar, Thank you for your posting. My question is fairly basic. I recreated your table of "Return multiple values vertically" above and entered the exact formula. However, it doesn't work.
I entered in the C8 cell --> =INDEX($C$2:$C$6, SMALL(IF($B$8=$B$2:$B$6,ROW($B$2:$B$6)-MIN(ROW($B$2:$B$6))+1),ROW(A1)))
And excel gave me -- > #VALUE!
If I copied your formula directly from the formula bar to my sheet in C8 cell, excel would return #VALUE! as well. However, if I copied an entire cell, and paste into my C8, excel would return exact same value as your original table. I am using Excel Mac 2008 but I don't believe this would have anything to do with it. Please let me know. I really appreciate your time. Thank you very much.
January 20th, 2012 at 5:37 am
Just want to tell you: THANK YOU! Your web is great, your are very generous. Thank you for sharing!
January 20th, 2012 at 2:07 pm
Dawisee,
You forgot to create an array formula.
How to create an array formula
1. Double click cell C8.
2. Paste formula
3. Press and hold Ctrl + Shift
4. Press Enter
Gab,
Thank you for commenting!
January 22nd, 2012 at 9:50 pm
My formula no working, I follow your steps but there´s somethink wrong..., please give me a hand!
=INDEX($B$1:$C$700;SMALL(IF(($D$90=$B$1:$B$700);ROW($B$1:$B$700)-MIN(ROW($B$1:$B$700))+1;"");ROW(A1));2)
January 24th, 2012 at 3:28 pm
VIC,
I think you forgot to create an array formula.
January 25th, 2012 at 12:01 pm
=LEFT(INDEX($C$2:$C$13546,SMALL(IF($E$3=$B$2:$B$1300,ROW($B$2:$B$1300)-MIN(ROW($B$2:$B$1300))+1,""),COLUMN(A1))),11)
Hi Oscar,
Your code works perfect but hen I reach $B$1300 or more the result will be #VALUE! Please help!
thanks a lot,
jener
January 30th, 2012 at 7:18 pm
Jener,
adjust cell references (bolded):
February 1st, 2012 at 10:56 am
Hi Oscar,
thanks for the reply,
I have no clue how to adjust it.
Can you give me a sample. lets say in Column B and C there are 100000 rows
Is this the right code for it:
=LEFT(INDEX($C$2:$C$100000,SMALL(IF($E$3=$B$2:$B$100000,ROW($B$2:$B$100000)-MIN(ROW($B$2:$B$100000))+1,""),COLUMN(A1))),11)
need your expert advice,
jener
February 2nd, 2012 at 10:54 pm
Jener,
I thought you copied the array formula horizontally? You are using column(A1) in your formula.
Your example seems to be right.