+ Reply to Thread
Results 1 to 13 of 13

Compare Cells in Column A, and add all like rows together

  1. #1
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Compare Cells in Column A, and add all like rows together

    Hello! I'm looking for some help with a macro. I have a list of SKUs, and I'd like to be able to run a macro that finds all like SKUs, adds the values in columns C, D, E, F, and G in the first row of the like SKU, and delete the remaining rows. Here is an example.

    Before Macro:

    BlstSGMXAplIph5Blk 0 28 22 0 11
    BlstSGMXAplIph5Blk 6 39 7 0 2
    BlstSGMXAplIph5Blu 0 5 0 0 0
    BlstSGMXAplIph5Blu 0 13 0 0 0

    After Macro:

    BlstSGMXAplIph5Blk 6 67 29 0 13

    BlstSGMXAplIph5Blu 0 18 0 0 0

    Can anyone help me?
    Last edited by TimBZKK; 04-26-2013 at 07:07 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: Compare Cells in Column A, and add all like rows together

    Are they sorted or can they be sorted?
    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
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Compare Cells in Column A, and add all like rows together

    They can, as long as the SKUs stay with their numbers. The SKU is an inventory item (on the left), and the numbers on the right are quantity posted, quantity closed, quantity sold, quantity left in inventory, and hits per day. So those values have to stay with the SKUs, but they can be sorted up and down.

    Normally, I would just use a pivot table, but this is going to be a list of 400+ items, update bi-weekly.
    Last edited by TimBZKK; 04-25-2013 at 04:08 AM.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Cells in Column A, and add all like rows together

    It is difficult to see your data in text format. Please attach a sample book.

  5. #5
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Compare Cells in Column A, and add all like rows together

    Done and done!

    SampleBook.xlsx

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Cells in Column A, and add all like rows together

    Try the attached
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Compare Cells in Column A, and add all like rows together

    This works perfectly! Thank you very much!

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Cells in Column A, and add all like rows together

    Tim,
    You are welcome!

  9. #9
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Compare Cells in Column A, and add all like rows together

    Quick question, AB33. If I want to drop that last column from my sheet (the Hits Per Day column), how would I go about changing the macro scripting?


    **Edit**

    Nevermind, I didn't see that it was creating a new sheet every time, I thought it was the same sheet. My bad!
    Last edited by TimBZKK; 04-25-2013 at 06:44 PM.

  10. #10
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Compare Cells in Column A, and add all like rows together

    Ok, I am getting an issue with this code that I did not see until now. It's removing all duplicate rows, but it's only adding two together. Some of the SKUs have 3 or 4 copies. Any idea how I would go about fixing this? the code is below:

    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Cells in Column A, and add all like rows together

    The code was written for the attached sample. It was meant to add values in columns C-G if SKUs are identical. That is column A.
    I do not think it only adds two rows and left the rest of the rows if all these rows are identical. I want to see your sample and show me what is not working.

  12. #12
    Registered User
    Join Date
    04-17-2013
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Compare Cells in Column A, and add all like rows together

    This should have a larger range of values to work with.

    Book2.xlsx

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Cells in Column A, and add all like rows together

    I did not see any issue with my first code, still works as it did the first time. I have lighted the duplicates using conditional formatting. If you are looking for any match, not just identical ones, this is a wrong code. It only deals with exact match words as Pivot Table does.
    Attached Files Attached Files

+ 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