+ Reply to Thread
Results 1 to 4 of 4

TTEST with non-contiguous range

  1. #1
    Registered User
    Join Date
    11-16-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    TTEST with non-contiguous range

    I am trying to perform a TTEST on conditional values that are non-contiguous. I am working off of a master sheet that has all my data and need to sort it conditionally (>0 & < 15, >15 & <45, >45 & <90, etc.). I have not found a way to do this using built-in excel functions.

    Additionally, I have tried to create a macro that will copy the master sheet to a new worksheet then filter it to the desired conditions, but when I perform the TTEST, it uses ALL the data entries, not just the desired filters entries and therefore returns a useless TTEST.

    Ideally I would like to just be able to input the data into my master sheet and then have all other sheets conditionally updated automatically.

    Any help would be greatly appreciated.

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

    Re: TTEST with non-contiguous range

    Not immediately clear but could you not use an Array ? eg

    Please Login or Register  to view this content.
    If you need further assistance I would suggest posting a sample file which illustrates your setup and outline desired/expected results.

  3. #3
    Registered User
    Join Date
    11-16-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: TTEST with non-contiguous range

    An array works when I use a single condition IF function, but in some of my calculations I have multiple conditions that I need to evaluate:
    1. 0 < x < 8
    2. 8 < x < 22
    3. 22 < x < 35
    4. etc.

    When I try:
    {=TTEST(IF(AND(G:G>0,G:G<15),I:I ),IF(AND(G:G>14,G:G<45),I:I ),2,3)}

    I just get #VALUE!

    I have attached a sample worksheet attempting to demonstrate what I am trying to do.

    Any help in solving this dilemma would be greatly appreciated.

    Thanks!
    Attached Files Attached Files

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

    Re: TTEST with non-contiguous range

    When conducting AND tests in Arrays you should either embed the IFs or multiply the Boolean Arrays TRUE/FALSE Booleans coerced are 1/0 respectively thus when multiplied together only if all are TRUE will output be 1 (and conversely working in reverse only 0 equates to FALSE).

    {=TTEST(IF((G1:G100>0)*(G1:G100<15),I1:I100),IF((G1:G100>14)*(G1:G100<45),I1:I100),2,3)}

    Avoid using entire column references for two reasons

    1 - not backwards compatible (ie G:G would generate #NUM! error pre XL2007)

    2 - Arrays are expensive formulae thus keeping ranges as lean as possible is of paramount importance.

+ 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