+ Reply to Thread
Results 1 to 17 of 17

complex subtotal macro of dynamic packsize drinks

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    complex subtotal macro of dynamic packsize drinks

    I have a worksheet in which data is sorted in column L which is a merge concatenation of column H to K.

    My issue is how to make subtotal drinks packsize of columns L in red but there are also mixed food items and column T,U,V,W THEN column AB TO AD.
    which are normal subtotals .

    Looking a macro that can do these function in one click for all the concerned columns subtotals in which the headers are bold red to last data row.

    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 30x1x75CL FR Total


    21069090 FOOD PREP. FR
    21069090 FOOD PREP. FR
    21069090 FOOD PREP. FR Total
    Attached Files Attached Files

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: complex subtotal macro of dynamic packsize drinks

    All you need is this...

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    Tried but it is not adding where there are pack size drinks in subtotal columns in red bold ,
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 6x1x75CL FR
    22042199 WINES 30x1x75CL FR Total

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,273

    Re: complex subtotal macro of dynamic packsize drinks

    This is actual content in [L284] in Sorted work sheet...Differs from your result sheet
    22042199 WINES 6x1x75CL FR Total
    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 star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    Yes It is the actual content if I used normal subtotal,

    22042199 WINES 6x1x75CL FR Total

    should read

    22042199 WINES 30x1x75CL FR Total

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,273

    Re: complex subtotal macro of dynamic packsize drinks

    Now I get it ...My bad lol

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

    Re: complex subtotal macro of dynamic packsize drinks

    JEAN1972

    Run the code after Subtotal.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,273

    Re: complex subtotal macro of dynamic packsize drinks

    Perhaps unorthodox but think it does the job...
    Please Login or Register  to view this content.
    Just saw jindon beat me to it...He's obviously the better code...
    Last edited by sintek; 01-13-2018 at 07:40 AM.

  9. #9
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    @ Jindon Thank you works as a charm

    @Sintek Thank for your effort but I did not get the correct results

    I attached sample workbook with the correct expected results from Jindon solution and that of yours.
    Attached Files Attached Files

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,273

    Re: complex subtotal macro of dynamic packsize drinks

    Hi JEAN1972

    Yes i noticed you had the code prior to a small update I made after editing...
    Please just check again...See Result in upload. Just for my peace of mind...like i say not as glamorous as jindon's...
    Thank you
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    Hi Sintek

    Tried your code but not expected results.

    See sheet sorted work normal 2 tab where I applied your code
    Attached Files Attached Files

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,273

    Re: complex subtotal macro of dynamic packsize drinks

    You need to change for the correct sheet...

    Please Login or Register  to view this content.

  13. #13
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,273

    Re: complex subtotal macro of dynamic packsize drinks

    Here is your original file housing code....Just run Macro and compare...
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    OK thanks Sintek working now

    I noticed on last line

    22087090 LIQUEURS 12x8x70CL IE Total should read 22087090 LIQUEURS 6x8x70CL IE Total

    also the grand total did not appear in the final row


    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    Quote Originally Posted by jindon View Post
    JEAN1972

    Run the code after Subtotal.
    Please Login or Register  to view this content.

    Hello Jindon

    I have a worksheet where the same principles applies as above but column position differs from the first one .

    the first columns subtotals involved were L,T,U,V,W,AB,AC,AD for the solution provided.

    Now I have a second attachment ,column involved in subtotals are N,U,V,W,X,AF which the headers involved are in yellow font

    I have tried to change interchange columns in the code but unsuccessful ,can you advise where to change the parameters so it works on the second attachement
    Attached Files Attached Files

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

    Re: complex subtotal macro of dynamic packsize drinks

    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: complex subtotal macro of dynamic packsize drinks

    Thank you for explanation, works as a charm

+ 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] formula to extract unique data and adding drinks pack size description only
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-29-2017, 03:34 PM
  2. Searching for the biggest packsize
    By sebasat in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2015, 09:23 PM
  3. [SOLVED] Subtotal help for dynamic columns!
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2015, 04:05 AM
  4. Replies: 1
    Last Post: 09-18-2013, 04:10 PM
  5. Dynamic code for Subtotal function
    By mike_vr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2013, 09:28 AM
  6. Maximum drinks for minimum ingredients.
    By fixit9660 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-19-2013, 03:56 PM
  7. [SOLVED] Subtotal complex
    By marreco in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-03-2012, 10:03 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