+ Reply to Thread
Results 1 to 4 of 4

running averge

  1. #1
    Registered User
    Join Date
    02-07-2008
    Posts
    2

    running averge

    I searched this but didn't find the right answer. It's very simple but I don't know formulas well.

    I want to keep a running average, meaning as i add new values (in this case my fuel mileage per gallon) i want to know the average of my previous averages. Right now i use =average(a1,a2). but i want a formula that will average a1, a2, a3, a4, a5 etc as i add them so that i don't have to manually rewrite the formula. I know simple enough.

    Thanks.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    In B1 (for example) put this formula
    Please Login or Register  to view this content.
    and drag it down. That formula checks the cell to the right (say A15) and if there's a number entered there, calculates the average from A1 to A15.

    ChemistB

  3. #3
    Registered User
    Join Date
    02-07-2008
    Posts
    2
    Thanks! I never would've figured that out. Do you think you could break down the syntax a little more so i can fully understand?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Sure, There's two parts to the equation, the actual average formula and an IF formula. We'll look at the IF formula first. The format for the IF is =IF(expression, is true, is false). Excel looks at the expression and puts one thing in the cell if it's true and a second thing if it's false. So;
    Please Login or Register  to view this content.
    looks in cell A1 and if there is a number there, it calculates the average, if not it leave it blank ("").

    The second part of the formula is the average function. =AVERAGE(RANGE) You want the range to change from row to row. A range can be cells separated by a comma (as you did initially) or by placing a colon between the first and last cell. Thus A1:A5 is the same as A1,A2,A3,A4,A5. The range A1:B2 is A1,B1,A2,B2.

    When you drag a formula, the cells automatically update to the new cells (Otherwise, you'd have to manually type each individual formula in each cell). The $in front of a cell lock that part of the cell in place ($A1 locks the column, A$1 locks the row, $A$1 locks both) so that when you drag it, that reference remains constant.

    Soooo, as we drag that formula down the rows, the $A$1 remains constant and the A1 changes with each row. So in cell B5 for example, it's going to read
    Please Login or Register  to view this content.
    and so on. Knowing how to use locked or fixed references and relative references is a huge tool in writing Excel formulas.

    Any questions?

    ChemistB

+ 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