+ Reply to Thread
Results 1 to 13 of 13

formula to get an average based on a dropdown list.

  1. #1
    Registered User
    Join Date
    07-14-2009
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Question formula to get an average based on a dropdown list.

    Hello People,

    Im creating a spreadsheet at work, which has a drop down box with the options of open and closed in it.

    I also have a column for length of time of the claim, what i need to do, is now find a way of getting a average length of a claim, but only to see the closed option from the drop down box.

    for example,

    row 1
    open date - 02/06, closed date - 01/07, dropdown box - closed, life - 29
    row 2
    open date - 10/06, closed date - n/a, dropdown box - open, life - -39400

    as you can see from the example above, i cant simply do a average of the whole column, as would read the open ones as well. so is there a way of doing the formula, but telling it to only see the open, or closed ones?

    You help will be greatly appreciated!!
    Last edited by ialexander03; 07-14-2009 at 11:05 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Help please on a formula for a dropdown list.

    I forgot, can you use AVERAGEIF in XL2003...

    =AVERAGEIF(C4:C14;"open";D4:D14)

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Help please on a formula for a dropdown list.

    If not try this:

    =SUMPRODUCT(--($C$4:$C$14="open");$D$4:$D$14)/SUMPRODUCT(--($C$4:$C$14="open"))
    Last edited by zbor; 07-14-2009 at 07:07 AM.

  4. #4
    Registered User
    Join Date
    07-14-2009
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Help please on a formula for a dropdown list.

    Hi,

    Thanx for you help so far, but both formulas return a message that states it contains a error.

    do you have any other ideas?

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Help please on a formula for a dropdown list.

    try to replace ; with , due to different settings.

  6. #6
    Registered User
    Join Date
    07-14-2009
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Help please on a formula for a dropdown list.

    Thanx again for that,

    I have tried the 1st option, the averageif statement, and i have replaced ; with , and now it is accpeting it, but shows #name? in the destination box!

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Help please on a formula for a dropdown list.

    Try second way (also replace ; with ,) and adopt formula to where your data is placed (C4:C14 and D4:D14 is just example

    =SUMPRODUCT(--($C$4:$C$14="open"),$D$4:$D$14)/SUMPRODUCT(--($C$4:$C$14="open"))

  8. #8
    Registered User
    Join Date
    07-14-2009
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Help please on a formula for a dropdown list.

    i have done this, and still a error, this time, #value!

    im sounding like a noob now, but what do the $ mean/do? and are they needed?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help please on a formula for a dropdown list.

    Perhaps posting a workbook sample may help resolve your issue..
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  10. #10
    Registered User
    Join Date
    07-14-2009
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Help please on a formula for a dropdown list.

    Quote Originally Posted by zbor View Post
    Try second way (also replace ; with ,) and adopt formula to where your data is placed (C4:C14 and D4:D14 is just example

    =SUMPRODUCT(--($C$4:$C$14="open"),$D$4:$D$14)/SUMPRODUCT(--($C$4:$C$14="open"))
    thats awesome, with some tinkering ans some swearing, it now works!!

    thank you so much!!!!

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: formula to get an average based on a dropdown list.

    As I see it there's no need to use SUMPRODUCT - use SUMIF/COUNTIF which are more efficient:

    =SUMIF($C$4:$C$14,"Open",$D$4:$D$14)/COUNTIF($C$4:$C$14,"Open")

    SUMPRODUCT generally only required for multi conditional tests (ie 2+ conditions) and/or where you are obliged to manipulate the source data as part of the calculation which as I read it is not the case here.

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: formula to get an average based on a dropdown list.

    I wasn't sure what XL2003 has of AVERAGEIF, COUNTIF, SUMIF functions...
    I played on sure

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: formula to get an average based on a dropdown list.

    I wasn't sure what XL2003 has...
    In terms of those inbuilt functions specific to 2007 seen on the board most regularly:

    AVERAGEIF / AVERAGEIFS

    SUMIFS

    COUNTIFS

    IFERROR

    (Also worth remembering that ATP functions (NETWORKDAYS, WORKDAY, EDATE, EOMONTH, MROUND etc etc) require activation of ATP Add-In pre XL2007)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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