+ Reply to Thread
Results 1 to 26 of 26

Eliminate duplicate text

  1. #1
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Eliminate duplicate text

    Hey All

    I have a spreadsheet where I need to eliminate duplicate text as attached - basically it is the Spec Tag column I want to eliminate duplicates from

    It strikes me it should be pretty simple, but for some reason I can't get any of my usual formulas to work

    Anyone any ideas?
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Eliminate duplicate text

    Please try at F4

    =IFERROR(INDEX(C$1:C$61,AGGREGATE(15,6,ROW($C$4:$C$61)/(MATCH($C$4:$C$61,$C$1:$C$61,)=ROW($C$4:$C$61)),ROWS(F$4:F4))),"")
    Attached Files Attached Files

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Eliminate duplicate text

    in F4:
    =IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW($C$4:$C$61)/(COUNTIF(F$3:F3,$C$4:$C$61)=0),1)),"")


    and in G4:

    =IF(F4="","",VLOOKUP(F4,C:D,2,FALSE))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Eliminate duplicate text

    F4=IFERROR(INDEX(C$4:C$100,SMALL(IF(FREQUENCY(IF(C$4:C$100<>"",MATCH($C$4:$C$100&$D$4:$D$100,$C$4:$C$100&$D$4:$D$100,0)),ROW(C$4:C$100)-ROW($C$4)+1),ROW(C$4:C$100)-ROW($C$4)+1),ROWS($C$4:C4))),"")

    Control+shift+enter

    copy across and down

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Eliminate duplicate text

    Your result seems bit off. CLG-22 is also present in Spec Tag column, but not in your result required.

    As well, there are instances of CLG-30 A & B, which has different Specification Description (both A & B has 2 description, which are duplicated).

    If you only need unique from Spec Tag... assuming Excel 2016.
    In F4:
    =INDEX($C$4:$C$61,MATCH(0,COUNTIF($F$3:F3,$C$4:$C$61),0))

    Confirmed as array (CTRL + SHIFT + ENTER). Copy down.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Eliminate duplicate text

    In F4 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In G4 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Does that work for you?

    Note: You missed CLG-22 in your unique listing. I didn't notice the differing descriptions. I assume those are errors. Also, this formula is not an Array formula (Don't need CNTRL SHFT ENTER).
    Attached Files Attached Files
    Last edited by ChemistB; 02-02-2021 at 02:35 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Eliminate duplicate text

    I may as well give you another approach. Put this formula in A4:

    =IF(D4="","",IF(COUNTIF(C$4:C4,C4)=1,MAX(A$3:A3)+1,"-"))

    Copy down to the bottom of your data, to identify the first occurrence of a spec-code. Then you can use this in E4:

    =IFERROR(INDEX(C:C,MATCH(ROWS($1:1),$A:$A,0)),"")

    Copy into F4, then copy E4:F4 down until you start to get blanks.

    Same comments apply as in Post #5.

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Thanks Bo Ry - That works!

  9. #9
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Glen

    Yep, that works! Thanks!

    I had been trying to work it out myself for a couple of hours before I posted and one of the options I was trying to work with was countif - but I had it in the wrong place!

  10. #10
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Thanks for your response

    For some reason, I could not get your formula to work - it brought up a blank cell

  11. #11
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    ChemistB

    Thanks for your response! Yep, that works. Interesting to see another way of doing things...

    I realised I had missed CLG-22 form the answers only after I copied the first response into the spreadsheet: busy day!

  12. #12
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    CK76

    The A and B relates to the fact that there are two versions of that spec with very slight differences.

    I could not get your formula to work - the first two lines worked, then it repeated CLG-155 for the rest of the spaces

  13. #13
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Everyone

    Thanks for your responses!

    I wondered if there was a way to put the list in the correct numerical order? My immediate priority was to remove the duplicates, that is a great help! But it strikes me it would be handy to be able to put the list in numerical order as the actual specfications can then be read more straight from the list

  14. #14
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Eliminate duplicate text

    I checked everyone's formula's and they should work. I took the liberty of putting them all into this workbook (Columns F and G). Only CARACALLA's formula looks at both columns to pull unique values. My guess is that you didn't perform CNTRL SHFT ENTER for the arrayed formulas.

    TO your new question: Have you considered a Pivot Table? I put a pivot table in Column I, Format as Tabular with repeating labels. I pulled over (into "Rows") both columns C and D so it works more like CARACALLA's formula. If you aren't worried about that, then just pull over Col C and use a VLOOKUP. See Attached.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    ChemistB

    I tend to try and not use pivot tables as I use the information that such formulas spit out as the basis of other formulas and I find it difficult to understand where the info has come from in the table. In this case I will be using the Tags list as the starting point to bring in information from the actual specs in another workbook and also in another workbook for a pricing schedule. It will just be simpler to use formula rather than a pivot table.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Eliminate duplicate text

    You can, but it requires an array formula:

    =IFERROR(INDEX($C$4:$C$61, MATCH(SMALL(IF((COUNTIF($F$3:F3,$C$4:$C$61)=0), COUNTIF($C$4:$C$61, "<"&$C$4:$C$61), ""), 1), COUNTIF($C$4:$C$61, "<"&$C$4:$C$61), 0)),"")

    These are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see the curly brackets { } appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  17. #17
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Eliminate duplicate text

    In this case I will be using the Tags list as the starting point to bring in information from the actual specs in another workbook and also in another workbook for a pricing schedule.
    In such cases, I'd strongly recommend using Power Query to transform data from both workbooks and load them to data model.
    You can then create relationship within data model and create pivot table to report on it. Without need to worry about maintaining various formulas in worksheet.

    Though it may seem a lot of work at beginning, I usually find that downstream maintenance is much easier and more than makes up for the initial workload.

    Sample M code to generate result (assuming you want distinct record based on both A & B columns).
    Please Login or Register  to view this content.
    Steps:
    1. Create Dynamic Named Range "myData" with following formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    2. Data -> Get & Transform -> Get Data -> From Other Sources -> Blank Query (or you can skip rest of the step by copying and pasting M code above in Advanced Editor in query editor).

    3. Enter following as Source.
    Please Login or Register  to view this content.
    4. Promote First Row as header.

    5. Select any column and right-click remove Empty.

    6. Remove [Room] column.

    7. Select both remaining columns and right click, remove duplicates.

    8. Return result to worksheet.

    You can right click and refresh table to bring in new data if it's added to original data.

    See Query1 sheet in sample attached. To see applied steps in query, go to Data -> Queries & Connections. And double click on Query1 in Queries pane.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Glen

    The formula worked fine in the ceilings section, but when I tried to put it into the walls and floors sections, which are longer, it did not work - see sheet 2 in teh attached

    At first it did bring in the correct order - or something like it - in the floors section, see column G in the attached that shows what came up

    column F is the answer column in this case blank columns are to replicate the actual spreadsheet
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    CK

    I will come back to reply to you later as I will need to get my head around your response!

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Eliminate duplicate text

    OK. In your sample sheet (which was OK) the formula was set to the exact range of your data. In sheet 2 col F it was set too long. It fell over.

    Option 1 (now col G). Set exact range. It works perfectly, but is a pain 'cos you need to maintain the formula when you add/subtract things.

    Option 2 (now col H). Use a Dynamic Named Range. This auto adjusts the range for you as you add/subtract values in the list. It still doesn't like gaps in the middle of the data, but adjusts to ensure that none exist at the end of the range. Its other advantage is that it makes the formula more human readable.

    I created a Named Range called .... wait for it.... Floors. CTRL F3 to view/edit. It looks like this:

    =Sheet2!$N$5:INDEX(Sheet2!$N:$N,MATCH("Zzzz",Sheet2!$N:$N))

    The array formula for the sorted list now becomes:

    =IFERROR(INDEX(Floors,MATCH(SMALL(IF((COUNTIF($H$4:H4,Floors)=0), COUNTIF(Floors, "<"&Floors), ""), 1), COUNTIF(Floors, "<"&Floors), 0)),"")

    see fle.
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Glenn

    I thought I had replied to this:

    Yep, I see now that I need to have the exact range!

    I chose the first option as, if I do need to add things in, it is easy to change the formula once and copy down.

    Thanks for your help!

  22. #22
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Eliminate duplicate text

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

  23. #23
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Hey Glen

    It tells me I must spread some reputation around before giving it to you again!

    I thought I had pressed it for everyone!

    I have marked the thread Solved

  24. #24
    Registered User
    Join Date
    04-08-2019
    Location
    Manchester
    MS-Off Ver
    2016
    Posts
    96

    Re: Eliminate duplicate text

    Cancelled - the formula does work in 365

    Glen

    Should the last version of the formula (see below ie the one that sorts the list alphabetically) work in Excel 365?

    IFERROR(INDEX($C$4:$C$61, MATCH(SMALL(IF((COUNTIF($F$3:F4,$C$4:$C$61)=0), COUNTIF($C$4:$C$61, "<"&$C$4:$C$61), ""), 1), COUNTIF($C$4:$C$61, "<"&$C$4:$C$61), 0)),"")

    I can't seem to get it to work: it just keeps repeating the first result when I drag it down...
    Last edited by QSGuy; 01-04-2022 at 11:40 AM.

  25. #25
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Eliminate duplicate text

    For this formula, it depends on where you paste it. Like you show above, paste it at F5 and drag down. It should probably work that way.
    I didn't test or openend any file, just a guess

  26. #26
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Eliminate duplicate text

    You can paste this everywhere


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Eliminate duplicate values
    By nsd3 in forum Excel General
    Replies: 2
    Last Post: 10-27-2010, 08:31 PM
  2. Eliminate Duplicate records
    By harshaputhraya in forum Excel General
    Replies: 2
    Last Post: 11-17-2007, 06:36 AM
  3. eliminate duplicate rows
    By maacmaac in forum Excel General
    Replies: 1
    Last Post: 01-10-2007, 01:33 PM
  4. How do I VBA....to go through a recordset and eliminate duplicate
    By marthasanchez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2006, 02:45 PM
  5. [SOLVED] how do i eliminate duplicate records?
    By RobR in forum Excel General
    Replies: 11
    Last Post: 05-03-2006, 10:10 AM
  6. eliminate duplicate in a column
    By jaya in forum Excel General
    Replies: 4
    Last Post: 10-18-2005, 04:05 PM
  7. How to eliminate duplicate entries
    By fnx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-06-2005, 05:22 PM
  8. How to eliminate duplicate entries
    By Tara Keane in forum Excel General
    Replies: 4
    Last Post: 03-02-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1