+ Reply to Thread
Results 1 to 8 of 8

Average for Conditional Criteria

  1. #1
    Registered User
    Join Date
    05-13-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    18

    Average for Conditional Criteria

    Hello,

    I have a condition specific to COUNTIF and SUMIF.

    In the attached spreadsheet, the desired result is inputted in column "E" and "F".

    Basically, for the multiple condition here is to check for repeat values in "Test ID" and "Test Set" (simultaneously).

    For example,

    For "ADDERT THREE" its repeated thrice. Twice against "Test Set 2" and once against Test Set 1". So in the "Unique count" column for "ADDERT THREE" the desired value should be split against the test set. Also, the column C is populated based on "COUNTIF", hence the unique value for the "Test ID" is 2 i.e. in case of "ADDERT THREE" the unique value is 2 and this is divided by the number of times it is repeated against the test set. In this case, the unique value is 2 and "ADDERT THREE" is repeated thrice against two unique test set.

    Also the unique value should repeat only once against the test id.

    Here is the logic - "ADDERT THREE" is repeated thrice against "TEST SET 1" and TEST SET 2". and the unique count is 2. So the logic should divide 2 by the number of times (unique) the test id is repeated i.e. by 2 as the unique repetition is 2 and the value 1 should be populated against the first test set which is 1 for "Test Set 1" and 1 for "Test Set 2". Also, the third repeat value of "Test ID" should be 0.(in case it is repeat against the same "test set")

    For Unique sum, it needs to follow the same logic but only difference is it should sum.

    Similarly, for "ADDERT SIX" unique count should be 1.66 which is 5 divided by 3( no of times test id is repeated uniquely against three unique Test set - Test set 1, Test set 2 and test set 3) which is around 1.66. Same logic for sum which would be 450/3 2 which is 150.

    Also, if there is no complications of repetition in terms of test id, it should return the same value which is in column C.

    I have tried the logic of COUNTIFS and SUMIFS simultaneously with AVERAGEIFS but I could not get the desired value.

    I appreciate and thank all the help I can get on this.

    Thanks
    Attached Files Attached Files
    Last edited by rebug16; 06-02-2018 at 08:18 AM.

  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,202

    Re: Average for Conditional Criteria

    I used two helper columns:

    in G2

    =IF(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2)=1,1,0)

    in H2

    =IF($G2<>0,SUMIF($B$2:B2,B2,$G$2:G2),0)

    in E2

    =IF($G2<>0,C2/MAX(($B$2:$B$10=$B2)*($H$2:$H$10)),0)

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy across and down
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-13-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    18

    Re: Average for Conditional Criteria

    I apologize for thanking so late.

    Thank you so much John.

    I realised that there is an additional condition which filters out Test ID against a test set. Same logic holds good but instead of taking the reference as Column C (Test ID Unique Count), we have to replace it with the "Valid Test ID Count"

    I tried using IF(AND) condition and tried to add this logic i.e. "D>0", but the similar result is not reflecting even after applying Array.

    I have modified the data in the attached spreadsheet. The desired output is updated in "Column G and Column H" (I had to remove the two helper cells you had included)

    Could you please help me with this modified logic.

    Thanks
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-13-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    18

    Re: Average for Conditional Criteria

    Hello,

    Any update on this?

    Thanks

  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,202

    Re: Average for Conditional Criteria

    You will need to sort data by

    Test ID _ascending
    Test Set_ ascending
    Valid test ID count-Largest to Smallest

    Helper in I

    =IF($D2>0,IF(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2)=1,1,0),0)

    Helper in J

    =IF($I2<>0,SUMIF($B$2:B2,B2,$I$2:I2),0)

    in K

    =IF($I2<>0,C2/MAX(($B$2:$B$15=$B2)*($J$2:$J$15)),0)

    in L

    =IF($I2<>0,E2/MAX(($B$2:$B$15=$B2)*($J$2:$J$15)),0)

    BOTH above are array-entered

    I have no idea how you got your results in column H
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-13-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    18

    Re: Average for Conditional Criteria

    HI John,

    Thank you for your help on this.

    Sent you a Private Message. Here is the data for that. Data also has description.

    Really appreciate your help.

    Thanks
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-13-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    18

    Re: Average for Conditional Criteria

    Hi John,

    Can this be done in Excel? The final value is in column P and Q. The logic for final result is also is inputted there.

    Thanks so much for your help on this.

    Thanks

  8. #8
    Registered User
    Join Date
    05-13-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    18

    Re: Average for Conditional Criteria

    Hello,

    Any update on this?

    Thanks

+ 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. Average based on criteria and multiple criteria
    By batchjb69 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-05-2016, 04:30 AM
  2. [SOLVED] Average with 3 criteria
    By FivestarMac in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2016, 05:40 PM
  3. [SOLVED] Sort by largest, 2nd criteria by less than average %, 3rd criteria pre defined heading.
    By deanusa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-01-2015, 12:27 PM
  4. [SOLVED] Average with criteria
    By pauldaddyadams in forum Excel General
    Replies: 2
    Last Post: 11-03-2014, 05:18 AM
  5. [SOLVED] Average using 2 > and < criteria
    By lemans96 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-13-2013, 02:42 PM
  6. Replies: 5
    Last Post: 05-05-2010, 10:32 AM
  7. Changing conditional average formula to conditional sumproduct
    By chlor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-29-2007, 11:39 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