+ Reply to Thread
Results 1 to 7 of 7

Average if

  1. #1
    Registered User
    Join Date
    10-10-2008
    Location
    South Africa
    Posts
    3

    Average if

    Hi

    I would like to understand what the formula would look like to achieve the following:

    Column A Column B
    P1 08:22
    P2 02:45
    P1 03:15
    P3 00:45
    P3 11:14
    P2 21:07

    Column A is formated to contain Text
    Column B is formated to contain HH:MM data
    I now want to calculate the average time (HH:MM) for all the occurences of "P1" in Column A. (i.e. what is the average of 08:22 and 03:15)

    Please help.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Hi WildWill, and welcome to the forum.

    You can average time values in Excel, because Excel stores time and date values as numbers. In your example, you should be able to use the array formula:

    =AVERAGE(IF(A1:A6="P1",B1:B6))

    After typing or editing this formula, you must press CTRL+SHIFT+ENTER, not just ENTER. This will insert braces, {}, around the formula automatically when done correctly.

    Remember to format this cell as Time (hh:mm:ss), otherwise you'll see a decimal number, which represents a time of day.

  3. #3
    Registered User
    Join Date
    10-10-2008
    Location
    South Africa
    Posts
    3
    Excellent! What is the purpose of the CTRL+SHIFT+ENTER, not just ENTER. This will insert braces, {}?

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Array formulas - formulas meant to work over a range of cells - need to be confirmed with CTRL+SHIFT+ENTER. Please visit the following links for more detailed explanations and examples:

    http://www.cpearson.com/excel/ArrayFormulas.aspx

    http://office.microsoft.com/en-us/ex...872901033.aspx

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702
    Hello Will,

    Are your times clock times or elapsed times, i.e. the time something happened or the length of time something took?

  6. #6
    Registered User
    Join Date
    10-10-2008
    Location
    South Africa
    Posts
    3

    COUNTA with IF?

    Quote Originally Posted by WildWill View Post
    Hi

    I would like to understand what the formula would look like to achieve the following:

    Column A Column B
    P1 08:22
    P2 02:45
    P1 03:15
    P3 00:45
    P3 11:14
    P2 21:07

    Column A is formated to contain Text
    Column B is formated to contain HH:MM data
    I now want to calculate the average time (HH:MM) for all the occurences of "P1" in Column A. (i.e. what is the average of 08:22 and 03:15)

    Please help.
    Sorted on the above query! Now, considering the above data set, I want to count the number of cells in Column B which have values in them (like a COUNTA) but only where Column A = "P3", for example. I.e. the answer will be "2" for this example. Awesome Forum!
    Last edited by WildWill; 10-10-2008 at 01:19 PM.

  7. #7
    Forum Contributor
    Join Date
    02-28-2006
    Posts
    690
    =sumproduct((a1:a6="p3")*(b1:b6<>""))

+ 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. Moving average of a moving average in the same cell
    By philroberts1983 in forum Excel General
    Replies: 8
    Last Post: 09-16-2008, 07:36 AM
  2. Working out an average based on a previous cell contents
    By panther_sn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-08-2008, 09:11 AM
  3. average formula
    By kingy in forum Excel General
    Replies: 3
    Last Post: 06-22-2008, 02:11 PM
  4. Q: Getting average of simulated die rolls?
    By Ranger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2007, 05:14 PM
  5. Determining the average of the 50 largest values in a column
    By NondestructiveT in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-01-2007, 10:28 AM

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