+ Reply to Thread
Results 1 to 5 of 5

Vba subtotal code the places results in different column

Hybrid View

Bevg Vba subtotal code the places... 04-13-2016, 05:10 PM
CAntosh Re: Vba subtotal code the... 04-13-2016, 05:33 PM
Bevg Re: Vba subtotal code the... 04-13-2016, 06:14 PM
CAntosh Re: Vba subtotal code the... 04-15-2016, 09:38 AM
Bevg Re: Vba subtotal code the... 04-15-2016, 02:23 PM
  1. #1
    Registered User
    Join Date
    12-11-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    51

    Vba subtotal code the places results in different column

    Hi,

    I'm trying to figure out a way to use VBA to subtotal the # of apples column based on the Name column. However the results need to be in the Apple subtotal column.

    Is there a way?

    sorry for the underline is was the only way I could show my data in a table format

    Name___#of apples____Apple subtotal
    Bob________1
    Bob________3___________ 4
    Jane_______ 5
    Jane_______ 1___________ 6
    Sam _______1 ___________ 1
    Hanna______2
    Hanna______2
    Hanna______4___________ 8

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Vba subtotal code the places results in different column

    Is VBA a requirement? If you have names in column A and # in column B, putting the formula below in C3 and filling down through your data should give you the desired results:

    =IF($A3<>$A4,SUM($B$2:$B3)-SUM($C$2:$C2),"")

  3. #3
    Registered User
    Join Date
    12-11-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Vba subtotal code the places results in different column

    Hi, Thanks. I tried it and it misses the 3 and 4th occurrence of the name. I will tinker with the formula and see if I can get it to work. But thanks for the quick response.

    I did try the vba
    Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3), _
    Replace:=False, PageBreaks:=False, SummaryBelowData:=True

    Can changed the TotalList Array to the 3 column and the result was zero because "TotalList" is looking for the data to add together.

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Vba subtotal code the places results in different column

    Quote Originally Posted by Bevg View Post
    it misses the 3 and 4th occurrence of the name.
    I'm not sure what you mean? I've attached a workbook so you can see what I'm seeing, take a look...

  5. #5
    Registered User
    Join Date
    12-11-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Vba subtotal code the places results in different column

    Ok, the workbook help tremendously. It showed me what I was doing wrong. Yes your KING/QUEEN (cannot tell from your login id) OF THE SPREADSHEET! Thank you so much it works!!

+ 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] Have formula results/textbox to round value at 0 decimal places
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2015, 09:58 AM
  2. Subtotal VBA Code Causing Error Stating Excel Not Able To Discern Column Headings
    By Aimee S. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-21-2014, 05:37 PM
  3. [SOLVED] Select Case Code for Column A Values to Populate Results in Column B in Same Row
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-28-2014, 05:22 PM
  4. Remove equal places from ranked competitors results.
    By clovelly in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 10-31-2013, 07:51 AM
  5. Replies: 1
    Last Post: 09-18-2013, 04:10 PM
  6. Replies: 8
    Last Post: 07-31-2012, 09:41 AM
  7. Subtotal results in new column and then sorting subtotals
    By ArtM in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-17-2005, 09: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