+ Reply to Thread
Results 1 to 5 of 5

Add Duplicates and Save On Instance

  1. #1
    Forum Contributor
    Join Date
    10-04-2014
    Location
    USA
    MS-Off Ver
    MS Office 2013
    Posts
    146

    Add Duplicates and Save On Instance

    I am looking for a macro that will evaluate "Column A"
    IF there are duplicates in "Column A" ......... add the "Column C" values and save only one instance. I have an example attached.

    Thanks so much!
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add Duplicates and Save On Instance

    1) In D1 enter this formula: =SUMIF(A:A, A1, C:C)
    2) Copy that formula down column D
    3) Copy the new values in column D
    4) Click on C1 and do a Paste Special > Values to update that column
    5) Clear the column D you added
    6) Now highlight your full data table and do a Data > Remove Duplicates function using only column A as the filter.


    Video: http://screencast.com/t/h1iZcxfUVU
    (sorry the sound is so bad)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    10-04-2014
    Location
    USA
    MS-Off Ver
    MS Office 2013
    Posts
    146

    Re: Add Duplicates and Save On Instance

    this looks good. but I have another wrinkle if you don't mind.
    I have attached another sheet that has a tab "real data"

    this is a raw data file and all the other lines must stay in place even the "" I want to only delete the yellow line in this case.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add Duplicates and Save On Instance

    1) Insert a blank row 1
    2) Put "Key" in B2
    3) In C2 enter this formula, then copy down:
    =IF(LEN($A2)>4,IF(COUNTIF($A$2:$A2,$A2)=1,SUMIF($A:$A,$A2,$B:$B),"delete"),"")
    4) Copy C2:C12 and Paste Special > Values onto B2.
    5) Clear column C
    6) Click on column B and turn on the Data > Filter
    7) Use the drop down to filter for "delete"
    8) Delete the visible rows
    9) Now delete row1, this will remove the row you added and turn off the Autofilter at the same time.
    Last edited by JBeaucaire; 11-12-2014 at 03:25 PM.

  5. #5
    Forum Contributor
    Join Date
    10-04-2014
    Location
    USA
    MS-Off Ver
    MS Office 2013
    Posts
    146

    Re: Add Duplicates and Save On Instance

    perfect! Thanks for all of the help!!!!!!!!!!!!

+ 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] Count duplicates and duplicates with suffix as one instance
    By ruraljur0r in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2014, 12:38 AM
  2. Highlighting all duplicates except the last instance
    By bopsgtir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2013, 06:57 PM
  3. highlight all duplicates EXCEPT first instance
    By Blake 7 in forum Excel General
    Replies: 7
    Last Post: 04-27-2012, 01:33 AM
  4. Replies: 6
    Last Post: 03-29-2012, 12:16 AM
  5. keep n duplicates not just a single instance - how
    By TopDogDave in forum Excel General
    Replies: 1
    Last Post: 11-13-2010, 10:55 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