+ Reply to Thread
Results 1 to 9 of 9

Quirky Average Formula

  1. #1
    Registered User
    Join Date
    12-26-2015
    Location
    Las Vegas
    MS-Off Ver
    2013
    Posts
    56

    Quirky Average Formula

    Hello Gurus,

    I need help once again... I have attached an example. I will try to make as simple as possible...

    Average formula (I have been playing with AVERAGEIFS, but cannot solve) needs to see multiple columns of information to give a solution.

    Things to know about full data:
    There is more than one Area
    There is more than one Service level
    There are quite a few Codes (two below as an example and I can adjust code to add more)
    Ranges are dynamic

    The formula must average the duration time for unique Areas seen in column "A".

    Then from column "D" for all deliveries that are "TRUE" in column "E" in combination with those that are "FALSE" in column "E" that in addition have a blank cell in column "C" or a qualifying reason in column "C". Let's just say that "phone" and "request" are qualifying reasons.

    I hope that made sense because I need help and I feel a little nudge would do the trick!

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Quirky Average Formula

    Try

    =SUMPRODUCT((D2:D21)*((E2:E21="TRUE")+((E2:E21="FALSE")*(C2:C21="")+(C2:C21="Phone")+(C2:C21="request"))))/SUMPRODUCT(((E2:E21="TRUE")+((E2:E21="FALSE")*(C2:C21="")+(C2:C21="Phone")+(C2:C21="request"))))

    It would help if gave a manual calculation for your posted file.

  3. #3
    Registered User
    Join Date
    12-26-2015
    Location
    Las Vegas
    MS-Off Ver
    2013
    Posts
    56

    Re: Quirky Average Formula

    I apologize for not posting what was needed and thank you for your response however based on my calculation test using a straight AVERAGE formula the result should have been 5:41:13.

    This is the formula I have been trying to make work:

    =SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "phone")+SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "request")+SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "")/COUNTIFS(A:A, A2,B:B, "Standard",C:C, "phone")+COUNTIFS(A:A, A2,B:B, "Standard",C:C, "request")+COUNTIFS(A:A, A2,B:B, "Standard",C:C, "")

    BUT, it gives me the result of: 12:43:30

    Then when I separate them in two separate cells like this:

    =SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "phone")+SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "request")+SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "")

    =COUNTIFS(A:A, A2,B:B, "Standard",C:C, "phone")+COUNTIFS(A:A, A2,B:B, "Standard",C:C, "request")+COUNTIFS(A:A, A2,B:B, "Standard",C:C, "")

    Then I divided the SUMIFS result by the COUNTIFS result using a simple =cell1/cell2 I get: 5:41:13

    Is there a way to put these together like in the first formula I have?

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Quirky Average Formula

    Your formulae do not consider column E (TRUE/FALSE) as per your initial posting.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Quirky Average Formula

    Try

    =(SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "phone")+SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, "request")+SUMIFS(D:D,A:A, A2,B:B, "Standard",C:C, ""))/(COUNTIFS(A:A, A2,B:B, "Standard",C:C, "phone")+COUNTIFS(A:A, A2,B:B, "Standard",C:C, "request")+COUNTIFS(A:A, A2,B:B, "Standard",C:C, ""))

    You need enclose the SUMIFS and COUNTIFS in brackets to get the correct mathematical sequence (BODMAS!) ..Brackets, Operators, Divide, Multiple, Add , Subtract
    Last edited by JohnTopley; 11-27-2016 at 03:31 PM.

  6. #6
    Registered User
    Join Date
    12-26-2015
    Location
    Las Vegas
    MS-Off Ver
    2013
    Posts
    56

    Re: Quirky Average Formula

    OMG I have been beating my head on the desk over some parenthesis??

    And... RE the other post you made... I know... my approach to using the data has changed since my first post... sad thing is I put a lot of thought into my first post!!!

    I'm going to test this out and get back to you... thank you so much for your input.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Quirky Average Formula

    FYI

    you can shorten the formulae .

    =SUM(SUMIFS(D:D,A:A,A2,B:B,"Standard",C:C,{"phone","request",""}))

    =SUM(COUNTIFS(A:A, A2,B:B, "Standard",C:C, {"phone","request",""}))

    =SUM(SUMIFS(D:D,A:A,A2,B:B,"Standard",C:C,{"phone","request",""}))/SUM(COUNTIFS(A:A, A2,B:B, "Standard",C:C, {"phone","request",""}))

  8. #8
    Registered User
    Join Date
    12-26-2015
    Location
    Las Vegas
    MS-Off Ver
    2013
    Posts
    56

    Re: Quirky Average Formula

    Thank you so much for your help. I couldn't have done it otherwise. I'm just about finished with my project now!

    There is many other formulas that I have tweaked after this one and used. The final code that worked for my actual data was this:

    =(SUM(SUMIFS(Details!$AE:$AE,Details!$C:$C, $A2, Details!$N:$N, "Standard", Details!$AF:$AF, "TRUE")+SUM(SUMIFS(Details!$AE:$AE,Details!$C:$C, $A2, Details!$N:$N,"Standard", Details!$U:$U,{"","CONFIDENTIAL","CONFIDENTIAL",CONFIDENTIAL","CONFIDENTIAL"}, Details!$AF:$AF, "FALSE"))))/(SUM(COUNTIFS(Details!$C:$C, $A2,Details!$N:$N, "Standard",Details!$AF:$AF, "TRUE")+SUM(COUNTIFS(Details!$C:$C,$A2,Details!$N:$N,"Standard",Details!$U:$U,{"","CONFIDENTIAL","CONFIDENTIAL","CONFIDENTIAL","CONFIDENTIAL"},Details!$AF:$AF,"FALSE"))))

    Thanks Again!

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Quirky Average Formula

    You are very welcome.

    Thank you for the feedback and rep.

+ 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. Would it be quirky to say I love Excel?
    By ghanscom in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-08-2014, 05:47 AM
  2. Quirky VBA help
    By penrose1248 in forum Excel General
    Replies: 3
    Last Post: 08-01-2008, 02:20 PM
  3. Quirky Data Formatting
    By johnsid in forum Excel General
    Replies: 4
    Last Post: 02-02-2007, 02:03 PM
  4. [SOLVED] Quirky Code
    By bodhisatvaofboogie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2006, 09:18 AM
  5. quirky array not working
    By BorisS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-01-2006, 08:50 AM
  6. SUMPRODUCT Acting Quirky
    By RichK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-19-2005, 04:05 PM

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