SOLVED

Index removing duplicates

%3CLINGO-SUB%20id%3D%22lingo-sub-2396163%22%20slang%3D%22en-US%22%3EIndex%20removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2396163%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20that%20there%20is%20a%20simple%20amendment%20to%20this%20but%20I%20have%20been%20going%20around%20in%20circles.%26nbsp%3B%20I%20have%20a%20large%20dataset%20and%20I%20need%20to%20be%20able%20to%20list%20all%20instances%20that%20something%20appears%2C%20I%20have%20the%20following%20formula%20that%20does%20what%20it%20should%20but%20I%20want%20it%20to%20be%20able%20to%20not%20return%20duplicate%20values%2C%20so%20for%20example%20there%20may%20be%202%20groups%20with%20the%20same%20name%20but%20each%20has%20a%20different%20row%20due%20to%20the%20time%20an%20event%20takes%20place%20so%20I%20just%20need%20it%20to%20return%20this%20once%20(using%20the%20name)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%3DINDEX(%24U%242%3A%24U%24986%2CSMALL(IF(Blank!%24B%244%3D%24S%242%3A%24S%24986%2CROW(U%242%3A%24U%24986)-ROW(%24U%242)%2B1)%2CROW(1%3A1)))%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2396163%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2396555%22%20slang%3D%22en-US%22%3ERe%3A%20Index%20removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2396555%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F158100%22%20target%3D%22_blank%22%3E%40Machala%20Sentance%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20see%20you've%20had%20a%20lot%20of%20views%20to%20your%20question%20and%20no%20responses.%20If%20I%20might%20be%20bold%20here%2C%20it's%20partly%2C%20I%20suspect%2C%20because%20your%20question%20isn't%20exactly%20clear.%20It%20would%20help%20if%20you%20could%20post%20either%20the%20actual%20spreadsheet%20OR%2C%20if%20that%20contains%20confidential%20information%2C%20a%20mockup%20that%20illustrates%20the%20problem%20you're%20trying%20to%20solve.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20of%20that%20said%2C%20another%20approach%20to%20retrieving%20just%20one%20instance%20of%20a%20name%20or%20something%20that%20appears%20more%20than%20once%2C%20is%20the%20new%20UNIQUE%20function.%20Using%20it%20might%20resolve%20your%20issue.%20And%20if%20you%20specifically%20want%20to%20retrieve%20just%20one%20instance%20of%20the%20occurrence%20of%20the%20name%20%22Michala%22%20(for%20example)%20you%20could%20use%20FILTER%20in%20conjunction%20with%20UNIQUE.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThese%20do%20require%20the%20most%20recent%20version%20of%20Excel.%20From%20what%20you've%20written%20I%20am%20going%20to%20assume%20that%20you%20could%20write%20the%20formula%20on%20your%20own%20given%20some%20instruction%2C%20so%20here's%20an%20excellent%20introductory%20video%20on%20those%20new%20functions.%20%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9I9DtFOVPIg%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9I9DtFOVPIg%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2397216%22%20slang%3D%22en-US%22%3ERe%3A%20Index%20removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2397216%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20the%20reply%2C%20I%20have%20watch%20this%20and%20unfortunatley%20does%20not%20given%20me%20what%20I%20am%20really%20wanting%20(maybe%20it's%20impossible%20%3A)).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20a%20mock%20up%20of%20part%20of%20the%20spreadsheet%20shwowing%20where%20and%20what%20I%20am%20trying%20to%20do%20-%20if%20this%20is%20still%20not%20clear%20please%20let%20me%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20just%20need%20the%20activity%20to%20show%20once%20for%20the%20relevant%20staff%20member%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%20for%20all%20help%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2398222%22%20slang%3D%22en-US%22%3ERe%3A%20Index%20removing%20duplicates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2398222%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F158100%22%20target%3D%22_blank%22%3E%40Machala%20Sentance%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDepends%20on%20your%20version%20of%20Excel%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20269px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F284836iD18706ABDD0FCFFD%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ewith%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DUNIQUE(FILTER(Summary!C%3AC%2CSummary!B%3AB%3DC5))%0A%0Aor%0A%3DIFERROR(INDEX(%20Summary!%24C%241%3AINDEX(Summary!C%3AC%2CCOUNTA(Summary!C%3AC)%20)%2C%0A%20%20AGGREGATE(15%2C6%2C1%2F%0A%20%20%20%20%20%20%20%20(%20Summary!%24B%241%3AINDEX(Summary!B%3AB%2CCOUNTA(Summary!C%3AC)%20)%20%3D%24C%245)%2F%0A%20%20%20%20%20%20%20%20(COUNTIF(%24B%2428%3AB28%2C%20%20Summary!%24C%241%3AINDEX(Summary!C%3AC%2CCOUNTA(Summary!C%3AC)%20)%20)%3D0)*%0A%20%20%20%20%20%20%20%20ROW(%20Summary!%24C%241%3AINDEX(Summary!C%3AC%2CCOUNTA(Summary!C%3AC)%20)%20%20)%2C1))%2C%0A%20%22%22)%0Aand%20drag%20it%20down%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Contributor

Hi

 

I think that there is a simple amendment to this but I have been going around in circles.  I have a large dataset and I need to be able to list all instances that something appears, I have the following formula that does what it should but I want it to be able to not return duplicate values, so for example there may be 2 groups with the same name but each has a different row due to the time an event takes place so I just need it to return this once (using the name):

 

{=INDEX($U$2:$U$986,SMALL(IF(Blank!$B$4=$S$2:$S$986,ROW(U$2:$U$986)-ROW($U$2)+1),ROW(1:1)))}

 

Thanks in advance

5 Replies

@Machala Sentance 

 

I see you've had a lot of views to your question and no responses. If I might be bold here, it's partly, I suspect, because your question isn't exactly clear. It would help if you could post either the actual spreadsheet OR, if that contains confidential information, a mockup that illustrates the problem you're trying to solve.

 

All of that said, another approach to retrieving just one instance of a name or something that appears more than once, is the new UNIQUE function. Using it might resolve your issue. And if you specifically want to retrieve just one instance of the occurrence of the name "Michala" (for example) you could use FILTER in conjunction with UNIQUE.

 

These do require the most recent version of Excel. From what you've written I am going to assume that you could write the formula on your own given some instruction, so here's an excellent introductory video on those new functions. https://www.youtube.com/watch?v=9I9DtFOVPIg

 

Learn everything about our brand-new Dynamic Arrays and how you can use them to build advanced spreadsheets. Arrays (CSE) have long been present in Excel, bu...

@mathetes 

 

Thanks for the reply, I have watch this and unfortunatley does not given me what I am really wanting (maybe it's impossible :)).

 

I have attached a mock up of part of the spreadsheet shwowing where and what I am trying to do - if this is still not clear please let me know.

 

I just need the activity to show once for the relevant staff member

 

Thanks again for all help

 

@Machala Sentance 

Depends on your version of Excel

image.png

with

=UNIQUE(FILTER(Summary!C:C,Summary!B:B=C5))

or
=IFERROR(INDEX( Summary!$C$1:INDEX(Summary!C:C,COUNTA(Summary!C:C) ),
  AGGREGATE(15,6,1/
        ( Summary!$B$1:INDEX(Summary!B:B,COUNTA(Summary!C:C) ) =$C$5)/
        (COUNTIF($B$28:B28,  Summary!$C$1:INDEX(Summary!C:C,COUNTA(Summary!C:C) ) )=0)*
        ROW( Summary!$C$1:INDEX(Summary!C:C,COUNTA(Summary!C:C) )  ),1)),
 "")
and drag it down
best response confirmed by Machala Sentance (Contributor)
Solution

@Machala Sentance 

Check this. I think FILTER and UNIQUE does work
=UNIQUE(FILTER(Table1[Activity template hk],Table1[Suggested Staff hk]=C5,"None found"))

That's the formula I entered and it seemed to me at any rate that it produces the result you are looking for. I've attached the revised spreadsheet.

 

This first performs a FILTERing of the activity column based on the staff ID

Then the UNIQUE eliminates duplicates.

@mathetes 

@Sergei Baklan 

 

Hi Both

 

Many thanks for the replies, both work perfectly

 

Apologies I couldn't get the Unique/Filter to work but I now have a better understanding of it.

 

Thanks again