Dynamic search and filter formula

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
395
Office Version
  1. 2016
Platform
  1. Windows
I am looking for a dynamic formula that will search a column for specific numbers and the names attached to them. It would be like a unique value vlookup automated filter. It will have to be based on the code as names will be added to the code, and I can use a helper sheet with the codes in case of code changes. There are duplicate names, but these names are attached to different codes. I am looking to set this up due to the code and names appearing multiple times on another sheet, and manual entry needs to be reduced. Thank you for your assistance in advance



Column BColumn C
320711Name1
320712Name2
320712Name3
320713Name3
320715Name5
320715Name6
321701Name7
321711Name8
321711Name9
321711Name10
321712Name11
321712Name10
321713Name13
321713Name14
321713Name15
321713Name7
322711Name17
322712Name18
322712Name19
322712Name20
322714Name21
322714Name22
322715Name23
322715Name24
322717Name25
322718Name24
322719Name27
323711Name28
323711Name29
323712Name30
323712Name31
323712Name32
323713Name33
323713Name34
323713Name35
324701Name36
324701Name37
324701Name38
324711Name36
324712Name40
324713Name41
324713Name42
324713Name43
324716Name44
324718Name38
325701Name46
325711Name47
325711Name48
325711Name57
325711Name50
325721Name51
325721Name52
325721Name53
325721Name54
325721Name55
325731Name56
325731Name57
325731Name58
325731Name59
325741Name60
325741Name61
325741Name62
325741Name63
325751Name64
325751Name65
325751Name66
325751Name67
327712Name68
327712Name69
327713Name70
327713Name71
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I'm not entirely sure what you're asking. I think you want a list of the names which occur more than once, with the codes. If so, try:

Book3
ABCDEFGHIJK
1Column BColumn CDup NamesCodes -->
2320711Name1Name3320712320713   
3320712Name2Name7321701321713   
4320712Name3Name10321711321712   
5320713Name3Name24322715322718   
6320715Name5Name36324701324711   
7320715Name6Name38324701324718   
8321701Name7Name57325711325731   
9321711Name8 0    
10321711Name9 0    
11321711Name10 0    
12321712Name11
13321712Name10
14321713Name13
15321713Name14
16321713Name15
17321713Name7
18322711Name17
19322712Name18
20322712Name19
Sheet2
Cell Formulas
RangeFormula
F2:F11F2=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$2:C$100)/(COUNTIF($C$2:$C$100,$C$2:$C$100)>1)/(COUNTIF($F$1:$F1,$C$2:$C$100)=0)/($C$2:$C$100<>""),1)),"")
G2:K11G2=IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($B$2:$B$100)/($C$2:$C$100=$F2)/(COUNTIF($F2:F2,$B$2:$B$100)=0),1)),"")
 
Upvote 0
I always suck explaining what I am trying to do in excel.
or
I have a work sheet that has 4x the code numbers on it and the same amount of names to match. The codes you see above are specific to my tracker as well as any names attached to those codes. I am looking for a dynamic formula that will search all of Column B for the code can return the name connected to it. So if you think of how vlookup works or index, it would be similar but it would also sort out the unique values. So if

321711 had 5 people under it, but no matter how many times that code and names appear on another sheet, the formula only returns one unique value for the 5 names attached to that code.

If there is a way to attach a workbook it might better explain. Would you know of a way of attaching a workbook? If not I will work on attaching a another example sheet
 
Upvote 0
OK, how about:

Book3
ABCDEFG
1Column BColumn CCodeNames
2320711Name1321711Name8
3320712Name2Name9
4320712Name3Name10
5320713Name3 
6320715Name5 
7320715Name6 
8321701Name7 
9321711Name8 
10321711Name9 
11321711Name10 
12321712Name11
13321712Name10
14321713Name13
15321711Name10
16321713Name15
17321713Name7
18322711Name17
19322712Name18
20322712Name19
Sheet2
Cell Formulas
RangeFormula
G2:G11G2=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$2:C$100)/(B$2:B$100=$F$2)/(COUNTIF(G$1:G1,$C$2:$C$100)=0),1)),"")


Note that I added another 321711 value in row 15 to test with.

Also, you can't upload a workbook (or any file) directly to the forum, but you can put it on a file sharing site, mark it as public, then post the link here. But keep in mind, some people can't, or won't, download files that way due to company restrictions, or concern about viruses.
 
Upvote 0
Good day, Sorry for the delay in response was trying to apply the formula. I believe this is what I am looking for but when trying to apply it I noticed that there are gaps. At the same time the duplicate names and codes are to be considered unique but is seems they are omited duplicate names. Any names and codes that are the same would need to be displayed 1 time

so if there were 320711 NAME 1 was repeated 7 times out of the listing it would only show it 1 time for the results.


PROJECT 99.xlsx
BCDEFG
1320711Name1
2320712Name2Name1
3320712Name3Name2
4320713Name3Name3
5320715Name5 
6320715Name6Name5
7321701Name7Name6
8321711Name8Name7
9321711Name9Name8
10321711Name10Name9
11321712Name11Name10
12321712Name10Name11
Sheet1
Cell Formulas
RangeFormula
G2:G12G2=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C:C)/(B$1:B$99=B1)/(COUNTIF(G$1:G1,$C$1:$C$99)=0),1)),"")




How I am intending on using the formula. The code column is going to be a helper sheet to itself. The names in column c is based off a sheet that will continuously have information copy and pasted in the same sheet. The names from the formula will be on a static sheet. I hope this all makes sense.
 
Upvote 0
There are a couple of issues with the way you applied the formula. And honestly, I'm still not sure I understand your requirements.

First, the current formula:

=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C:C)/(B$1:B$99=B1)/(COUNTIF(G$1:G1,$C$1:$C$99)=0),1)),"")

The part in red here should be ROW(C$1:C$99), not ROW(C:C). It needs to match up with the range sizes later in the formula (in blue). This should be the range where your data is. If you want to search the entire column, it would be:

=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C:C)/(B:B=B1)/(COUNTIF(G$1:G1,C:C)=0),1)),"")

but I do NOT recommend this. It will really slow down your sheet. If you think your range might have a 1000 rows, use 2000 for the end row, that'll still be much better than searching over a million rows.

Second issue:

=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$1:C$99)/(B$1:B$99=B1)/(COUNTIF(G$1:G1,C$1:C$99)=0),1)),"")

the part in red should be
(B$1:B$99=B$1)

without the $ in front of the 1, that value will change to B2, B3, etc. as you drag the formula down the column. That's why you get some blank rows. It's searching for some duplicates for a different value, but there aren't any new duplicates. So the corrected formula is:

Excel Formula:
=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$1:C$99)/(B$1:B$99=B$1)/(COUNTIF(G$1:G1,C$1:C$99)=0),1)),"")

Change the 99 to whatever is the bottom row of your data.
Hopefully, that will fix your problems. If not, please manually figure out what results you want for the sample above, and show a mini-sheet with those results. If you have another example with expected results, that will help too.
 
Last edited:
Upvote 0
I went back and attempted to start from scratch. Basically, I left both columns b and c the same, only adding "name2" to be duplicated. I posted the original formula from your second posting and this is what I ended up with.
PROJECT 99.xlsx
BCDEFG
1320711Name1
2320712Name2Name1
3320712Name2 
4320713Name3 
5320715Name5 
6320715Name6 
7321701Name7 
8321711Name8 
9321711Name9 
10321711Name10 
11321712Name11 
12321712Name10 
13321713Name13 
14321713Name14 
15321713Name15 
16321713Name7 
17322711Name17 
18322712Name18 
19322712Name19 
20322712Name20 
21322714Name21 
22322714Name22 
Sheet1
Cell Formulas
RangeFormula
G2G2=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$1:C$99)/(B$1:B$99=B$1)/(COUNTIF(G$1:G1,C$1:C$99)=0),1)),"")
G3:G22G3=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C$1:C$99)/(B$1:B$99=B$1)/(COUNTIF(G$1:G2,$C$1:$C$99)=0),1)),"")



I am not sure how I mess this up starting from scratch.

Would this be easier if there were a helper sheet with all the codes listed to assist with sorting thru all the codes in column B?
 
Upvote 0
This shows that I don't really know what you want. That formula is doing what it's designed to do - for the number 320711, it's showing all the unique names. That doesn't seem to be what you want. Given the sample above, can you manually show me what results you want in column G?
 
Upvote 0
So you see how name one appears but nothing else? The next name should be name2 then name3 being that name2 and the code are the same. The code and the name create a unique value just like name7 and name10. These two would show up twice due to the code and the name being unique.
 
Upvote 0
So are you saying that only row 3 should be eliminated from the list, since it's a duplicate of row 2? I couldn't think of a way to do it without using the number as well:

Book1
ABCDEFGH
1320711Name1NumberName
2320712Name2320711Name1
3320712Name2320712Name2
4320713Name3320713Name3
5320715Name5320715Name5
6320715Name6320715Name6
7321701Name7321701Name7
8321711Name8321711Name8
9321711Name9321711Name9
10321711Name10321711Name10
11321712Name11321712Name11
12321712Name10321712Name10
13321713Name13321713Name13
14321713Name14321713Name14
15321713Name15321713Name15
16321713Name7321713Name7
17322711Name17322711Name17
18322712Name18322712Name18
19322712Name19322712Name19
20322712Name20322712Name20
21322714Name21322714Name21
22322714Name22322714Name22
23
Sheet2
Cell Formulas
RangeFormula
G2:H22G2=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$1:B$22)/(COUNTIFS($G$1:$G1,$B$1:$B$22,$H$1:$H1,$C$1:$C$22)=0),1)),"")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top