+ Reply to Thread
Results 1 to 8 of 8

VBA Sum based on matching values in multiple columns

  1. #1
    Registered User
    Join Date
    09-03-2018
    Location
    Holland
    MS-Off Ver
    2010
    Posts
    21

    VBA Sum based on matching values in multiple columns

    Hi All,

    I need to sum the values in column A per value in column D where in column B is Motorcycle A or Motorcycle B.

    So like this (left input, right wanted result):

    upload.png

    There is an excel file attached.
    note: the new data should not be copied to another sheet like in this example file

    Hope someone is able to help me out


    PS. I once asked a somewhat similar question but I had to change some things which resulted in different input, now i'm stuck again. This Post
    Attached Files Attached Files
    Last edited by TheOneWeDreamOf; 05-15-2019 at 08:54 AM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA Sum based on matching values in multiple columns

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    09-03-2018
    Location
    Holland
    MS-Off Ver
    2010
    Posts
    21

    Re: VBA Sum based on matching values in multiple columns

    Hi Mick, This works perfectly except for the fact that it is copied to a new sheet, I managed to fix this myself. Thanks!

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-03-2018
    Location
    Holland
    MS-Off Ver
    2010
    Posts
    21

    Re: VBA Sum based on matching values in multiple columns

    Hi Mick,

    I forgot to mention that in the columns next the data there are values that also should be left as is.

    So it is like this.

    Attachment 624631


    Could you please have a look at this, I can't seem to figure it out.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Sum based on matching values in multiple columns

    Here's how I do.
    Please Login or Register  to view this content.

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: VBA Sum based on matching values in multiple columns

    Great code Gents...
    Last edited by Sintek; 05-17-2019 at 03:12 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  7. #7
    Registered User
    Join Date
    09-03-2018
    Location
    Holland
    MS-Off Ver
    2010
    Posts
    21

    Re: VBA Sum based on matching values in multiple columns

    Hi Jindon,

    Thanks for the script. I want the motorcycle A and motorcycle B to be exact matches

    Please Login or Register  to view this content.
    Everything seems to work fine if I do like this except for the renaming part.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Sum based on matching values in multiple columns

    Just delete that line.
    That is not my original line though.

+ 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] How to highlight a row based on matching values from separate columns
    By MyStix01 in forum Excel General
    Replies: 2
    Last Post: 09-21-2017, 08:43 PM
  2. Finding Matching Values from Multiple Columns Based on Criteria
    By rmmohan in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-29-2017, 03:37 PM
  3. Align Rows based on Matching Values in 2 Columns
    By cmv040 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-05-2016, 07:49 PM
  4. [SOLVED] Matching multiple values in different rows and columns
    By drakaz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2013, 03:26 AM
  5. Replies: 6
    Last Post: 11-15-2012, 12:30 PM
  6. matching values based on criteria and return values from another columns
    By lizard54 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2012, 11:29 AM
  7. Comparing/Matching Values in multiple columns
    By BuddyB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2005, 04:06 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