+ Reply to Thread
Results 1 to 5 of 5

Remove duplicates (column A), based on highest value in column B?

  1. #1
    Registered User
    Join Date
    03-16-2021
    Location
    London, England
    MS-Off Ver
    365
    Posts
    31

    Remove duplicates (column A), based on highest value in column B?

    So I use Twitter and I sometimes export my tweet statistics to look at which ones are performing better than others.

    I sometimes tweet the same thing every 2-3 weeks, as I get new followers, followers live in different timezones etc. Therefore a report sometimes has duplicate tweets with different data (date, impressions, clicks etc)

    What I'm wanting to do is, remove duplicate tweets (and that entire row) in the excel spreadsheet, leaving the one with the highest engagement rate.

    Example...
    col A - B
    Tweet - Engagement Rate - Clicks

    Tweet 1 - 5.34% - 143
    Tweet 2 - 4.66% - 165
    Tweet 3 - 4.98% - 84
    Tweet 1 - 4.34% - 444
    Tweet 2 - 3.66% - 92
    Tweet 3 - 5.98% - 66

    What will be shown after dupes removed:

    Tweet 1 - 5.34% - 143
    Tweet 2 - 4.66% - 165
    Tweet 3 - 5.98% - 66

    As these have had the highest engagement vs their other duplicates.

    This ignores the click count.

    Can this be done in Excel without the need of entering a formula into a cell, and if not, does anybody know what formula I'll need?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,035

    Re: Remove duplicates (column A), based on highest value in column B?

    This can be done with Power Query.
    1. Group the table on the Tweet Nr. and find the max for that tweet.
    2. Merge the table on itself joining the tables on the Maxed Percent.

    See the attached file.

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    03-16-2021
    Location
    London, England
    MS-Off Ver
    365
    Posts
    31

    Re: Remove duplicates (column A), based on highest value in column B?

    Hi Alan,

    I've found a link online, but it's not letting me post.

    1. Select and copy column A which contains the duplicate values, and paste them to another place.
    2. Then select the values in the pasted list, and click Data > Remove Duplicates, and check Continue with the current selection option from the popped out dialog. Click Remove Duplicates, then in the Remove Duplicates dialog, check the column you want to remove duplicates from.
    3. Then click OK, and a dialog pops out to remind you how many duplicates have been removed, click OK to close it.
    4. Select a cell next to the list you have removed the duplicates from, enter this formula =MIN(IF($A$2:$A$12=D2,$B$2:$B$12)), press Shift + Ctrl + Enter keys, and drag fill handle down to the cell you need.

    If you want to remove all duplicates but leave the highest ones, you can apply this formula =MAX(IF($A$2:$A$12=D2,$B$2:$B$12)), remember to press Shift + Ctrl + Enter keys.

    Could this also work?

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,035

    Re: Remove duplicates (column A), based on highest value in column B?

    Could this also work?
    Did you test? Did it give you expected results? Only you will know if you get the results you want!

  5. #5
    Registered User
    Join Date
    03-16-2021
    Location
    London, England
    MS-Off Ver
    365
    Posts
    31

    Re: Remove duplicates (column A), based on highest value in column B?

    Quote Originally Posted by alansidman View Post
    Did you test? Did it give you expected results? Only you will know if you get the results you want!
    I'm away from my PC, on my mobile - I was just running it by you to see if it looks like it could work before I get home.

    I assume you're an Excel expert, so you may have spotted something incorrect.

+ 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. [SOLVED] Remove duplicates except those where value in column B is highest
    By AD_CTCH in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-28-2019, 09:08 AM
  2. Remove duplicates based on other column.
    By domcindor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2019, 06:13 AM
  3. Remove duplicates based on other column.
    By domcindor in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-13-2019, 10:07 AM
  4. remove duplicates based on name found in column b
    By antiKILLER in forum Excel General
    Replies: 2
    Last Post: 03-01-2016, 02:57 PM
  5. Replies: 5
    Last Post: 05-08-2014, 07:24 AM
  6. remove entire row based on duplicates from single column
    By mikemeadeuk in forum Excel General
    Replies: 2
    Last Post: 10-15-2011, 02:57 PM
  7. Replies: 3
    Last Post: 08-10-2006, 11:40 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