+ Reply to Thread
Results 1 to 7 of 7

Loop to Sym and Average values by System

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Loop to Sym and Average values by System

    Hello,

    I have two columns: System and Value, and I want to sum and average the Value for each system.
    So for example, system X should be Sum=400 and Average=200, System Y should be Sum=600 and Average=300, those values should be put into cells starting at column H.
    Actually the difficult part for me in this case is the logic. I was able to get the first system value and move to the next column, but not able to continue...
    Can someone help me please?
    I have attached the spreadsheet....
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Loop to Sym and Average values by System

    There is some initial code I wrote in the spreadsheet

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,615

    Re: Loop to Sym and Average values by System

    Pl see attached file.
    Attached Files Attached Files

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Loop to Sym and Average values by System

    SUMIF and AVERAGEIF will do that quicker than any VBA.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Loop to Sym and Average values by System

    I appreciate much your help, but I really need this in Excel VBA. I am stuck on the logic to use... I am able to calculate the average and SUM ofr the first system, when I go to seconds system I am unable to set counter to zero, I do not see yet a way to make it work. This is what I have so far(this code is new and is NOT in the attached spreadsheet), so in case you check this thread, please use the below code as reference:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Loop to Sym and Average values by System

    It worked now, with the following code:



    Please Login or Register  to view this content.

    I know this code it is not flexible but it is something to begin with..
    Does anybody see a better way to make it work? With a simple code?
    Last edited by trizzo; 05-18-2013 at 02:06 PM.

  7. #7
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Loop to Sym and Average values by System

    Now I would like to Average the values by System, but with data not in sequence like this:

    System Value
    X 400
    Y 328
    Z 222
    X 427
    Y 339
    Z 212
    X 409
    Y 347
    Z 205



    So with the above data I would like to have something like this resullt:
    For System X: Average of 1236 and Sum of 512
    For System Y: Average of 1014 and Sum of 338
    And so forth... so the only difference now is that the data of system is not in sequence

    Any suggestions on how to do that?

+ 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