+ Reply to Thread
Results 1 to 12 of 12

VBA code to automate calculation in column L:S

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    VBA code to automate calculation in column L:S

    Looking for VBA to automate calculation in column L:S due to large datasets. Already have a formula to look through column A and column B to do the sum of each unique firm. The sum formula looks through column A and column B and then perform the summation for each firm. The setback with this sum function is that the datasets is 400,000 and I have to split the data into 7,000 datasets for my workbook not to freeze or slow down - takes hours to get the results with the formula.

    Column L formula: = SUMIFS($D$2:$D$400000,$A$2:$A$400000,A2,$C$2:$C$400000,C2)

    Column M formula: = SUMIFS(E$2:E$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Column N formula: = SUMIFS(F$2:F$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Column O formula: = SUMIFS(G$2:G$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Column P formula: = SUMIFS(H$2:H$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Column Q formula: = SUMIFS(I$2:I$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Column R formula: = SUMIFS(J$2:J$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Column S formula: = SUMIFS(K$2:K$400000,$A$2:$A$400000,$A2,$C$2:$C$400000,$C2)

    Thanks
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    jindon: jindon provided this solution for a similar request and it worked.
    Similar request:Column J formula: =SUMIFS($D$2:$D$125,$A$2:$A$125,A2,$B$2:$B$125,B2)

    Column K formula: =SUMIFS($E$2:$E$125,$A$2:$A$125,A2,$B$2:$B$125,B2)

    Column L formula: =SUMIFS($F$2:$F$125,$A$2:$A$125,A2,$B$2:$B$125,B2)

    Column M formula: =SUMIFS($G$2:$G$125,$A$2:$A$125,A2,$B$2:$B$125,B2)

    Column N formula: =SUMIFS($H$2:$H$125,$A$2:$A$125,A2,$B$2:$B$125,B2)

    Column O formula: =SUMIFS($I$2:$I$125,$A$2:$A$125,A2,$B$2:$B$125,B2)

    Please Login or Register  to view this content.

    Thanks
    Attached Files Attached Files
    Last edited by bjnockle; 09-27-2020 at 07:58 AM.

  2. #2
    Registered User
    Join Date
    08-01-2020
    Location
    Viet nam
    MS-Off Ver
    2007, 2010
    Posts
    17

    Re: VBA code to automate calculation in column L:S

    Hi Bj.
    Do you have some sample file? Attachments excel file with output you want will easier to answer.

  3. #3
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: VBA code to automate calculation in column L:S

    excel_newbie86: Here is the sample file. Thanks.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: VBA code to automate calculation in column L:S

    Try this mod to Jindon's code
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: VBA code to automate calculation in column L:S

    Fluff13: Getting:

    Run-time error '9':
    Subscript out of range

    Please help fix. Thanks

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: VBA code to automate calculation in column L:S

    Which line?

  7. #7
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: VBA code to automate calculation in column L:S

    Fluff13: Did not give me the line.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: VBA code to automate calculation in column L:S

    What line is highlighted if you click debug?

  9. #9
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: VBA code to automate calculation in column L:S

    Quote Originally Posted by bjnockle View Post
    ... to look through column A and column B to do the sum of each unique firm ... the datasets is 400,000 ...
    If you care about the sums calculation for only unique items (firms) and with so much data (400,000 and more)
    it is better to use the simple SQL in vbe code, e.g.:
    (however, it is important that the data in the columns have the same format)
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by mjr veverka; 09-27-2020 at 01:53 PM.

  10. #10
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: VBA code to automate calculation in column L:S

    Fluff13 : Outstanding solution. Thanks a lot.

  11. #11
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: VBA code to automate calculation in column L:S

    porucha vevrku: Great solution. Thanks a lot.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: VBA code to automate calculation in column L:S

    You're welcome & thanks for the feedback.

+ 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. VBA code to automate calculation in column H
    By bjnockle in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-24-2020, 10:17 AM
  2. VBA code to automate calculation in column G, H and I
    By bjnockle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2020, 07:08 PM
  3. VBA code to automate calculation in column J:O
    By bjnockle in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-21-2020, 01:17 PM
  4. [SOLVED] automate average calculation
    By Mike_F in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 05-09-2017, 01:02 PM
  5. To automate Calculation of time taken
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2014, 03:00 PM
  6. VBA Code needed to automate page break(s) based on 3-column groupings
    By mkhammers in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-10-2013, 05:57 PM
  7. Automate Calculation with help of VBA
    By Dongfang in forum Excel General
    Replies: 2
    Last Post: 03-11-2011, 04:29 AM

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