+ Reply to Thread
Results 1 to 3 of 3

Calculating average of column if row meets criteria

  1. #1
    Registered User
    Join Date
    09-29-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Calculating average of column if row meets criteria

    I have a sheet with arrival and departure date and time.

    I would like to calculate the following at 18:00 on each day:
    • Occupancy (This has been resolved)
    • Average length of stay of those currently staying
    • Number of guests staying 7 days or more

    The attached file explains my request more clearly.

    Thanks in advance.

    DVS
    Attached Files Attached Files

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Calculating average of column if row meets criteria

    In J2
    =IFERROR(AVERAGEIFS($C$2:$C$23,$A$2:$A$23,"<="&G2,$B$2:$B$23,">="&G2),0)

    In K2
    =COUNTIFS($A$2:$A$23,"<="&G2,$B$2:$B$23,">="&G2,$C$2:$C$23,">="&7)
    or
    =SUMPRODUCT(($A$2:$A$23<=G2)*($B$2:$B$23>=G2)*($C$2:$C$23>=7))

    Also, no need for the double unary operators in Col H. Use
    =SUMPRODUCT(($A$2:$A$3637<=G2)*($B$2:$B$3637>=G2))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    09-29-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Calculating average of column if row meets criteria

    Thanks for the quick response. I'm just testing it out with some data I was given. I seem to have an issue with room occupancy (it's lower than expected - think it's to do with time) and the average stay is higher than expected (but I think it's the data that I am using as it appear to work on a smaller set of data). Will just check with other data and report back. Cheers.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula for calculating average cost in each column of my range given multiple criteria
    By bwmuhich in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-11-2013, 09:54 AM
  2. Need one column total if criteria meets another columns criteria
    By jebrown in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-24-2013, 08:47 PM
  3. Average of dates and times if it meets a specific criteria
    By Shadoweski in forum Excel General
    Replies: 1
    Last Post: 09-28-2010, 10:26 AM
  4. average if meets criteria
    By gelandl in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2010, 03:22 AM
  5. Sum a column that meets two criteria
    By terrapinie in forum Excel General
    Replies: 6
    Last Post: 03-31-2005, 02:06 PM

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