+ Reply to Thread
Results 1 to 4 of 4

Inventory code to remove duplicates and sum totals

  1. #1
    Registered User
    Join Date
    07-18-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Inventory code to remove duplicates and sum totals

    I have a sheet of inventory with product number and quantity. Unfortunately the list contains the same items on different rows. I tried to create a vba code to look up duplicates based on item number and then summing up their quantity and then deleting the second duplicate but it is instead deleting the majority of the list.
    Here is the code so far: (don't mind the matchnum as I thought i needed it but didnt use it) (Mainrow=19 because the data starts on row 19)
    Please Login or Register  to view this content.
    Thanks for your help!
    Attached Files Attached Files
    Last edited by Leith Ross; 07-18-2012 at 07:58 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Inventory code to remove duplicates and sum totals

    Hi Chilisauce,

    You don't want to increment your row indices after deleting a row.

    Something like this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    07-18-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Inventory code to remove duplicates and sum totals

    Thanks for the suggestion. Unfortunately the code deleted more rows. I took a look at my original code realized that it was looking at column 1 instead of 2. Fixed.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Inventory code to remove duplicates and sum totals

    Hi Chilisauce,

    Glad its fixed and you're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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