简体   繁体   中英

How do I remove all duplicates in one column, and keep the row with highest value (from another column)

I'm trying to remove duplicate CustomerIDs and keep the one with the highest CompositeRank.

CUSTOMERID     STORE      COMPOSITERANK
51872          FOS        5
51872          MOS        3
51872          BOS        2
10098          BOS        5
10098          MOS        3
10098          FOS        2
99102          MOS        5
99102          FOS        3
99102          BOS        2

After removing the proper duplicates, it should look like this:

CUSTOMERID     STORE      COMPOSITERANK
51872          FOS        5
10098          BOS        5
99102          MOS        5

Thanks for your time.

Multi step approach:

  1. Sort by customerID then compositerank Desc
  2. Add a formula similar to the following =IF(A2=A1,0,1) 3)
  3. add a filter for 1 achieve results similar to below screenshot.

在此处输入图片说明

If you need to retain ordering first add a column with 1 and then 1 + row above and fill the series down. Then after step 3, re-order based on column added.

you can then copy /paste results to different worksheet if needed, or just leave the non-highest ones hidden.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM