+ Reply to Thread
Results 1 to 6 of 6

t test with multiple (2) criteria not returning expected result

  1. #1
    Registered User
    Join Date
    05-08-2017
    Location
    London, Canada
    MS-Off Ver
    2016
    Posts
    3

    t test with multiple (2) criteria not returning expected result

    I am working on an array formula to perform a t-test with 2 criteria. The formula is "working" in that it returns a result but if I perform a manual t test (manually selected the ranges rather than depending on I statements, etc), the t test returns a different result.

    Formula I am using:


    =T.TEST(IF(($B$6:$B$70=$A$85)*($C$6:$C$70=$B$85),D6:D70),IF(($B$6:$B$70=$D$85)*($C$6:$C$70=$E$85),D6:D70),$B$86,$B$87)
    (with ALT_SHIFT_ENTER to make it an array formula)

    Criteria are set up as a drop-down in cells A85, B85 for the first half of the t test and D85, B85 for the second half of the t test.
    Cells B86 and B87 specify the # of tails, and type of t test.

    Has anyone ever check their multiple criteria ttest against a manually populated ttest and get different results???

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,889

    Re: t test with multiple (2) criteria not returning expected result

    Has anyone ever check their multiple criteria ttest against a manually populated ttest and get different results???
    Short but useless answer -- Yes, someone somewhere has had this problem.

    Half of programming is debugging, and that is just as true for spreadsheets as it is for other programming languages. I'm not sure how much help we can be in debugging this (without the raw data, anyway). There must be something different about your manually extracted array, and the array built by the IF(...),IF(...) part of the function. Debugging this is all about figuring out what those differences are, then figure out why they are different, then figure out what you need to do differently.

    My next first step: Pull up the Evaluate formula tool (https://support.office.com/en-us/art...6-a70aa409b8a7 ) and begin to step through the function. This will require patience, and will likely be accompanied by grumblings and groanings and cursings and "why oh why can't MS make a better formula evaluater debugging tool!". It appears that your formula builds an array of ~130 values, so you will need to figure out in the formula evaluater where those 130 values are different from manually extracted array that you are testing against.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    05-08-2017
    Location
    London, Canada
    MS-Off Ver
    2016
    Posts
    3

    Re: t test with multiple (2) criteria not returning expected result

    Yeah - short answer pretty much true. I always say that there rarely is a problem that someone has not had before.

    I started this part of my excel sheet last week and tried different things...tried the debugging tool and it WAS grabbing the right numbers. However, the difference is this:

    In the matrix formula, missing values are counted as 0 and included in the analysis. If the t.test is run and values manually selected, missing values are ignored. Hence, the t.test in the matrix behaves differently than when it is not in a matrix formula.

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: t test with multiple (2) criteria not returning expected result

    Quote Originally Posted by bjmatush View Post
    In the matrix formula, missing values are counted as 0 and included in the analysis.
    What do you mean by "missing values"?

    If you mean rows which do not satisfy your criteria, then you are incorrect, since, within your formula, i.e.:

    =T.TEST(IF(($B$6:$B$70=$A$85)*($C$6:$C$70=$B$85),D6:D70),IF(($B$6:$B$70=$D$85)*($C$6:$C$70=$E$85),D6:D70),$B$86,$B$87)

    the results of the two clauses:

    IF(($B$6:$B$70=$A$85)*($C$6:$C$70=$B$85),D6:D70)

    and:

    IF(($B$6:$B$70=$D$85)*($C$6:$C$70=$E$85),D6:D70)

    for rows which do not satisfy the two criteria in parentheses will result in a Boolean FALSE, not zero. And Boolean FALSEs are ignored by T.TEST's array1 and array2 parameters.

    If you had written your formula thus:

    =IFERROR(T.TEST(IF(($B$6:$B$70=$A$85)*($C$6:$C$70=$B$85),D6:D70,0),IF(($B$6:$B$70=$D$85)*($C$6:$C$70=$E$85),D6:D70,0),$B$86,$B$87),"")

    then you would be correct in your assessment, and this would indeed give a different result from that manually calculated, since, as you say, the zeroes would then be considered legitimate values to be passed to T.TEST.

    Regards
    Last edited by XOR LX; 05-08-2017 at 12:55 PM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  5. #5
    Registered User
    Join Date
    05-08-2017
    Location
    London, Canada
    MS-Off Ver
    2016
    Posts
    3

    Re: t test with multiple (2) criteria not returning expected result

    Without changing my formula, I removed the qualifying "tags" in columns B and C for the rows that had a black cell so that the matrix would not grab the value in column D (null). Once I did this, the 2 versions of the t.test agreed with one another.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,889

    Re: t test with multiple (2) criteria not returning expected result

    In the matrix formula, missing values are counted as 0 and included in the analysis.
    Interesting. You have left the "value_if_false" argument out of the IF() formulas, so I would have expected the "missing" "do not include" values to be the boolean FALSE rather than 0 (and the t.test function should ignore boolean values). I wonder why your function is converting the missing values to 0 rather than FALSE? I might suggest that you double check your evaluation and make certain that you are not seeing the 0's that are part of the "test condition" array (FALSE*FALSE=0 in the test condition part of the IF() functions).

    Whatever the reason, I might first try filling in some text string for the "value_if_false" arguments and see if that makes a difference. The T.TEST function should ignore text strings just like it ignores blanks.

+ 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] ISTEXT(SEARCH not returning expected result
    By Jutt369 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-30-2015, 05:25 AM
  2. hyperlink help need code not returning expected result (partial)
    By AkaTrouble in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-04-2015, 11:21 AM
  3. Replies: 4
    Last Post: 07-02-2013, 09:47 PM
  4. VLookup not returning expected result
    By tenscourts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2012, 10:04 AM
  5. COUNTIF not returning expected result
    By zpenacho in forum Excel General
    Replies: 3
    Last Post: 01-20-2012, 06:37 PM
  6. SUMIF - not returning expected result
    By Paul Sheppard in forum Excel General
    Replies: 4
    Last Post: 08-16-2011, 11:43 AM
  7. Using sum(1/countif....) not returning expected result
    By Kent (thanks) in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-11-2006, 11:40 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