+ Reply to Thread
Results 1 to 10 of 10

Macro to Create Total/Partial Sums

  1. #1
    Registered User
    Join Date
    03-06-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    5

    Macro to Create Total/Partial Sums

    Good Morning and Nice Day to everybody in the Forum!,

    Hope you are all doing great!

    Just new to VBA and Macros, but trying hard to improve my skills.

    At this point, I would be very glad if somebody could guide me to enhance one macro that I am developing in the excel attached.

    I am actually calculating the total sales for a given car dealership considering two columns: Make and Value of the Sale. This is very straighforward with two columns. However, I am going nuts when I am trying to add a third column with the name of Sales Reps in order to show the breakdown of sales per Sales Rep and Make. Please, could you advise on this matter? Moreover, I am wondering if there is a way to sum automatically new added rows.

    Many thanks in advance for any help!!

    Cheers.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-12-2014
    Location
    PL
    MS-Off Ver
    2010
    Posts
    55

    Re: Macro to Create Total/Partial Sums

    Hey,

    I think you may be overcomplicating things and a simple SUMIFS formula would do the trick.

    If you put the below in cell F2 and then drag down and right, would that get what you wanted? I can make that work for a range relative the amount of rows of data (in VBA), that is not a problem. Let me know if that is the right direction.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Macro to Create Total/Partial Sums

    And you could also use the "SUMPRODUCT" function

    Please Login or Register  to view this content.
    Alf

  4. #4
    Registered User
    Join Date
    03-06-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to Create Total/Partial Sums

    Many thanks for your answers JazzKult and Alf.

    I am just trying to automate the process with a macro. Just got there partially as I am able to calculate the totals with two columns, but I am not able to simulate the breakdown per Sales Rep if I include a Third Column. Any other feedback would be really welcome!!

  5. #5
    Registered User
    Join Date
    03-06-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to Create Total/Partial Sums

    Many thanks for your reply JazzKult. I am just trying to automate the process with a macro. Just got there partially as I am able to calculate the totals with two columns, but I am not able to simulate the breakdown per Sales Rep if I include a Third Column. The idea with the formula works absolutely fine, but wondering whether it would be possible to embed it within th VBA code. Cheers.

  6. #6
    Registered User
    Join Date
    12-12-2014
    Location
    PL
    MS-Off Ver
    2010
    Posts
    55

    Re: Macro to Create Total/Partial Sums

    Hi,

    If you're happy with keeping formulas in the cells but want them to be populated via VBA macro then you can go with the below. Might require some tune-up if you want to add more cars/sales reps (can do that if you tell me how you'd want this to work).

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-06-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to Create Total/Partial Sums

    Hi JazzKult,

    Many thanks again for your reply! The code provided works like a charm, however I wonder if it is possible to embed it with the Macro Button, so the calculations (both the Total Sales and Breakdown of sales) would be executed once when clicking on such button.

    Best.

  8. #8
    Registered User
    Join Date
    12-12-2014
    Location
    PL
    MS-Off Ver
    2010
    Posts
    55

    Re: Macro to Create Total/Partial Sums

    Ok how about this? Should be more flexible in the event you want to add more rows of data/sales reps/cars and will not keep the formulas just paste the values.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-06-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to Create Total/Partial Sums

    Hi JazzKult,

    This works perfect! A+++

    Many, many thanks!! Now, I'll try to make one big macro with the whole thing! Wish me lack!

    Best Regards!

  10. #10
    Registered User
    Join Date
    12-12-2014
    Location
    PL
    MS-Off Ver
    2010
    Posts
    55

    Re: Macro to Create Total/Partial Sums

    Happy to help. Best of luck C.!

+ 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. Creating a macro to insert a blank row and total sums in a new column
    By volleyballtigger in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-23-2013, 10:42 AM
  2. Problem with sums--how to sum only partial data?
    By amartino44 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-22-2013, 03:52 PM
  3. Independently variable entries, total sums to 100%
    By joefrankenheimer in forum Excel General
    Replies: 4
    Last Post: 05-14-2012, 08:47 AM
  4. Counting names, total time, and comparing sums
    By WillGabriel in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 11-27-2007, 04:19 PM
  5. [SOLVED] add non-contiguent sums in one column to a Grand Total
    By Ryan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-15-2006, 07:15 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