1. #1
    dcat2
    dcat2's Avatar Become A Pro!
    Join Date: 01-24-12
    Posts: 9
    Betpoints: 61

    An excel formula question

    I have isolated a large number of sets of 42 to 84 numbers arranged in columns. I want to write a (loop? code? equation?) that will place the previous average adjacent to the next cell. This means if my numbers going downwards read 20,40,40,80,20 then the adjacent column would read -- , 20 , 30 , 33.3 , 45. These numbers represent the average of all the numbers in the original column that come before this row. How can this be done? Thanks

    EDIT: Problem solved
    Last edited by dcat2; 02-08-12 at 12:09 AM. Reason: Problem Solved

  2. #2
    bink
    bink's Avatar Become A Pro!
    Join Date: 10-15-11
    Posts: 36
    Betpoints: 875

    You could do a simple equation. Assuming your original column starts at A1 and you average column starts at B2 then something like SUM(A$1:A1)/COUNT(A$1:A1). That's the simplest way. Or just use the AVERAGE function. AVERAGE(A$1:A1).
    Nomination(s):
    This post was nominated 1 time . To view the nominated thread please click here. People who nominated: dcat2

  3. #3
    trevlyn1983
    trevlyn1983's Avatar Become A Pro!
    Join Date: 05-25-09
    Posts: 940
    Betpoints: 2339

    easiest way I can think of is . go to the Next column . second row and type =AVERAGE($A$1:A2)

  4. #4
    trevlyn1983
    trevlyn1983's Avatar Become A Pro!
    Join Date: 05-25-09
    Posts: 940
    Betpoints: 2339

    bink beat me lol ~

  5. #5
    MonkeyF0cker
    Update your status
    MonkeyF0cker's Avatar Become A Pro!
    Join Date: 06-12-07
    Posts: 12,144
    Betpoints: 1127

    With VBA, you'd do something like this...

    Code:
    dim total as integer
    for i = 0 to 83
         total = total + Range("A1").Offset(i, 0)
         Range("A1").Offset(i, 1) = total / (i + 1)
    next
    This assumes a column containing 84 numbers starting at cell A1 and placing the running average in the B column.

  6. #6
    dcat2
    dcat2's Avatar Become A Pro!
    Join Date: 01-24-12
    Posts: 9
    Betpoints: 61

    thanks guys, this worked great

Top