+ Reply to Thread
Results 1 to 6 of 6

Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2003
    Posts
    12

    Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

    Marco for pivot table like fuctions. Subtotal column C, based on column B criteria. Column A is the product.
    Because the product code doesn’t copy down I can’t use pivot tables. In this example would need to merge code 82548
    COLUMN A B C
    206967711 82548 20%
    32338 20%
    82548 20%
    82661 20%
    103737 20%

    Need results as follows:
    COLUMN A B C
    206967711 82548 40%
    32338 20%
    82661 20%
    103737 20%

    This excel spreadsheet has many more rows which I deleted for security reasons. Most of my daily spreadsheets have thousands of lines which are tedious doing manually. Tried doing sumproduct, array and lookup value which didn’t work. Example spreadsheet is enclosed.
    It also would be OK to bring the new totals to column D and E. Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

    One way you could do this without a macro is to put this formula in an empty column to fill in the product codes for each Agent Code.
    =IF(TRIM(B2)="","",IF(TRIM(A2)="",D1,TEXT(A2,"@")))

    For this example, put it in cell D2 and fill down column D for all your data. Put a column header (Pcodes) in D1.

    Then create a pivot table where the Row Area has Pcodes and Agent CODE. The Data area has Sum of Agent PCT. Turn off row and column Grand Totals on the pivot table's option dialog.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    04-15-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

    This really helps a lot. One of the problems I have is deleting cells before I use your recomendation. Let me know if you now how to solve.

    If Column C = 0
    Delete cell B,C,D on the same line then move up cells B,C,D below with Loop

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

    Quote Originally Posted by RobertOHare View Post
    This really helps a lot. One of the problems I have is deleting cells before I use your recomendation. Let me know if you now how to solve.

    If Column C = 0
    Delete cell B,C,D on the same line then move up cells B,C,D below with Loop
    • Select column C
    • Select from the menu Data\Filter\Auto Filter
    • Select 0 from the C1 dropdown list
    • Select all the visible "zero" rows and delete

  5. #5
    Registered User
    Join Date
    04-15-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

    Thank you AlphaFrog. This has been a great help. Hope I can help others with my wisdom like you in the future. Bob O'Hare

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.

    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