+ Reply to Thread
Results 1 to 9 of 9

How to average alternating values across rows that meet a certain criteria

  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    7

    How to average alternating values across rows that meet a certain criteria

    Hi all,

    So I created a spreadsheet that lists "Scheduled" and "Actual" hours in columns for different months of the year. I would like to calculate the total average of "actual" hours for each row. The thing is, I only want to average the "actual" hours that ALSO have a "scheduled" hours of 1.5 beside them. I would like to be able to do this without rearranging the layout of the Spreadsheet (i.e. switching cols and rows).

    If this isnt possible, and rearrangement is a must please advise me on the fastest way to rearrange this. The attachment is only a small sample of my MASSIVE spreadsheet. Any advice is appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: How to average alternating values across rows that meet a certain criteria

    This works:

    Please Login or Register  to view this content.
    But it is sensitive to the layout being just as it is.

    It probably better demonstrates the reason for an alternate layout.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Registered User
    Join Date
    12-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to average alternating values across rows that meet a certain criteria

    Do I copy this to cell Z4 and drag down? If I do that it gives me incorrect values. The average for cell Z4 is supposed to be 0.68 not counting the 0's in the average. Also, what do the "--" do in the formula? thanks

  4. #4
    Registered User
    Join Date
    12-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to average alternating values across rows that meet a certain criteria

    nevermind, everything else except for the first cell seems to be working fine! so how would I modify this formula to account for the 0's? (so that they arent included in the average). And what do the "--" mean?

    Also, can I use the same formula for finding the average of the "actual" hours which have a corresponding "scheduled" hours of 3 as well?

    thanks!
    Last edited by doubleM3000; 12-10-2012 at 07:37 PM.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How to average alternating values across rows that meet a certain criteria

    Try using AVERAGEIFS - this formula in Z4 copied down

    =AVERAGEIFS(G4:Y4,G4:Y4,">0",G$3:Y$3,"Actual",F4:X4,1.5)

    Observes your other conditions but ignores zeroes in the average.....
    Audere est facere

  6. #6
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: How to average alternating values across rows that meet a certain criteria

    The formula is counting the number of "Scheduled" hours that equal 1.5 (nine in row 4). It sums the adjacent Actuals, and divides by the count. If you ignore the Actuals that equal zero, then you aren't getting a true average. That said, if you want the average in that manner, try:

    Please Login or Register  to view this content.
    The "--" is a double unary. It converts logical TRUE / FALSE to 1 / 0 values.

  7. #7
    Registered User
    Join Date
    12-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to average alternating values across rows that meet a certain criteria

    could you also please explain the term --(NOT(MOD(COLUMN(F5:X5) ?

  8. #8
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: How to average alternating values across rows that meet a certain criteria

    Since you appear to be using Excel 2010, then ddl's solution is a much easier one to work with.

  9. #9
    Registered User
    Join Date
    12-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to average alternating values across rows that meet a certain criteria

    Yes! Thank you all for your help!

+ 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