Feb 22 2020 05:24 AM
Hi everyone!
I'm working on a sheet for work. I am on my last task and can't seem to figure this one out. I'm hoping someone can help:
I have a data sheet with all the data. In my current sheet I would like it to return a list of all the names matching these two criteria. My formula is as follows:
=INDEX('Horse data'!B2:B100, MATCH(1, ($I$13='Horse data'!C2:C100) * ($K$13='Horse data'!D2:D100), 0))
The problem I have with it is that it returns duplicates, because for 2 or 3 cells, the first best match is the same, until my search area has moved down enough to continue on to the next match.
Is there any way to rewrite this formula to return a list of 'unique distinct values' and avoid duplicate returns?
Preferably without adding more columns, but if there's no other way I'd accept any solution!
Feb 22 2020 05:58 AM
SolutionIf you are on Excel with dynamic arrays that could be
=UNIQUE(FILTER('Horse data'!B2:B100,
(I$13='Horse data'!C2:C100) * ($K$13='Horse data'!D2:D100)
))
Feb 22 2020 06:28 AM
@SergeiBaklan Yes, that works great! Thanks a lot!
Oct 05 2021 08:39 PM
Hello, is there a way to tdo this in excel 2007 version? @SergeiBaklan
Oct 05 2021 09:43 PM
The problem gets complicated in Excel 2007. To simplify it, I used an auxiliary column, and array-entered the following formula in cell L2, then copy it down. The formula returns the values from column B that satisfy the two criteria.
=IFERROR(INDEX('Horse data'!B$2:B$100,SMALL(IF(($I$13='Horse data'!C$2:C$100) * ($K$13='Horse data'!D$2:D$100),ROW('Horse data'!B$2:B$100)-ROW('Horse data'!B$2)+1,""),ROWS(L$2:L2))),"")
The next step is to avoid duplicate returns. I did that by copying down another array-entered formula in column M:
=IFERROR(INDEX(L$2:L$100,SMALL(IF(IFERROR(MATCH(L$2:L$100,L$2:L$100,0),0)*(L$2:L$100<>"")=ROW(L$2:L$100)-ROW(L$2)+1,ROW(L$2:L$100)-ROW(L$2)+1,""),ROWS(M$2:M2))),"")
May 01 2022 12:31 PM
@SergeiBaklan im having a similar issue with an excel formula. When I drag this down, I am having duplicate returns until I another value hit. Do you know how the formula should look to delete the duplicates?
=INDEX('Walleye OMS'!B2:B303,MATCH('final (2)'!A3,'Walleye OMS'!U2:U303,0))
May 01 2022 12:53 PM
MATCH always returns the first match for the item sought. That's why it keeps duplicating the value returned.
I assume that you are copying the formula down in worksheet final (2) starting in row 3.
=INDEX('Walleye OMS'!B$2:B$303,AGGREGATE(15,6,(ROW('Walleye OMS'!U$2:U$303)-ROW('Walleye OMS'!U$2)+1)/('Walleye OMS'!U$2:U$303='final (2)'!A3),COUNTIF('final (2)'!A$3:A3,'final (2)'!A3)))
Brad
May 01 2022 03:14 PM
@Brad Yundt wow that worked thank you so much!!
May 01 2022 03:57 PM
Hi Brad, it looks like im running into a similar issue but on a different spreadsheet. im trying to grab all equity quantities and put it on a separate spreadsheet. Do you by chance have any idea what I may be missing?
=INDEX('Walleye JPMcopy)'!L$2:L$643,AGGREGATE(15,6,(ROW('Walleye JPMcopy)'!D$2:D$643)-ROW('Walleye JPMcopy)'!D$3)+1)/('Walleye JPMcopy)'!D$2:D$643="EQUITIES"),COUNT('Walleye JPMcopy)'!D$3:D3,'Walleye JPMcopy)'!D3)))
May 01 2022 04:55 PM
It would be helpful to see your actual workbook and know exactly where you want to put the formula.
I assumed that you are retrieving data from worksheet Walleye JPMcopy) column L, and are looking to return only those values that pertain to EQUITIES. I also assumed that your data start on row 2, and that the formula is also placed on row 2, possibly on a different worksheet. If so, you might try copying down:
=IFERROR(INDEX('Walleye JPMcopy)'!L$2:L$643,AGGREGATE(15,6,(ROW('Walleye JPMcopy)'!D$2:D$643)-ROW('Walleye JPMcopy)'!D$2)+1)/('Walleye JPMcopy)'!D$2:D$643="EQUITIES"),ROWS(D$2:D2))),"")
The suggested formula returns an empty string (looks like a blank) when there are no more EQUITIES.
If I guessed incorrectly, please post a sample workbook and tell me exactly which cell needs the formula.
May 01 2022 05:04 PM
Hi Brad,
Thank you for the input. I am trying to copy the data into cell G3 in spreadsheet Final (2) from sheet Walleye JPMcopy). I put "EQUITIES" because I was unsure where to select. Please let me know if you need more information.
May 01 2022 08:23 PM
May 01 2022 09:11 PM
This is my test workbook. Feel free to mark it up so I know what the formula is supposed to be doing.
Brad
May 02 2022 08:36 AM
@Brad Yundt im not able to attach my spreadsheet for some reason but hopefully these screenshots help. I am just trying to pull all quantities (equities) from Walleye sheet in to final sheet.
May 02 2022 08:57 AM - edited May 02 2022 11:07 AM
Have you tried the last formula I suggested? It should be working for the problem you show in the screenshots once you correct the names of the worksheets.
=IFERROR(INDEX('Walleye JPMcopy)'!L$2:L$643,AGGREGATE(15,6,(ROW('Walleye JPMcopy)'!D$2:D$643)-ROW('Walleye JPMcopy)'!D$2)+1)/('Walleye JPMcopy)'!D$2:D$643="EQUITIES"),ROWS(D$2:D2))),"")
May 02 2022 10:50 AM
May 02 2022 11:00 AM
May 02 2022 11:13 AM
"I did a Vlookup and that seemed to work!"
That's why you should post a sample workbook in the thread, or a link to one in your OneDrive. You probably would have gotten the right answer the first time.
Glad you got things sorted out.
Brad
May 03 2022 12:20 PM
@Brad Yundt@cweaver345414 it looks like i am running into a small issue with another formula. im trying to get all option quantities in the JPM Quantity tab, would you know what formula to use?
Feb 22 2020 05:58 AM
SolutionIf you are on Excel with dynamic arrays that could be
=UNIQUE(FILTER('Horse data'!B2:B100,
(I$13='Horse data'!C2:C100) * ($K$13='Horse data'!D2:D100)
))