+ Reply to Thread
Results 1 to 4 of 4

Help for Excel Beginner

  1. #1
    Registered User
    Join Date
    09-13-2006
    Posts
    1

    Help for Excel Beginner

    I am keeping track of Monthly Average Sick leave and Annual Average Sick Leave. Here is what my sheet looks like

    J F M A M Ju Mo. to Date Avg Annual Avg.
    1 4 0 8
    5 5 0 1

    6 9 0 9 0 0

    Ok, let's say that it is only the end of April. I have formulas adding up the columns through June. When I put this formula =AVERAGE(A5:F5) under the "Mo to Date Avg." it takes into account the zeros in May and June. Then I tried this formula =SUM(A5:F5)/4 which works fine but then every month I have to change the "divided by" number and there are alot of different depts. I have to keep track of. I want it to count the zero in March but not the zeros in the months to come. Is there any way to use a formula where I wouldn't have to change the formula every month - it would just automatically know not to calculate the "future" months?

    Thanks for any advice. Sorry, if I'm not explaining myself well.
    Last edited by rubydluxe; 09-13-2006 at 11:49 PM.

  2. #2
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    Well Yes and no, it needs to have a way of knowing what month you are up to. If you have a cell with the month in that you can change, it can be used to update the formula

    So lets say your month headings are in a3 to l3

    in cell A1 you have the most recent month you could either type this or go to data validation and choose from list and select the range a3:l3 as the list, this would ensure you type the values conistently

    then in your formula sum(a5:l5)/4 i have made it a full year

    change to sum(a5:l5)/match($a$1,$a$3:$l$3,0)

    the match matches the column heading and returns its position so thre fifth month returns 5. It does assume that the month names are unique, so April is A August must be something else eg Au

    I hope that makes sense if not get back to me

    Regards

    Dav

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Sure there's a better way but this might help

    =SUM($A$5:A5)/COLUMN()

    Enter formula in say A6 and drag to the right.

    The first A5 will be Static by the $'s and the other A5 will change to B5, C5 etc.
    The Column() will enter a one for Column A. When you drag to B2 it returns 2 and so on

    Hope it helps

    VBA Noob

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    One step on

    This is an array formula which needs to be entered with Ctrl + Shift + enter

    Changes if A2 to A4 are Empty it returns a blank. Range range as required

    =IF(A2:A4="","",SUM($A$5:A5)/COLUMN())

    VBA Noob

+ 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