+ Reply to Thread
Results 1 to 11 of 11

Extract values based on two (2) criteria

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Extract values based on two (2) criteria

    Would like formula to extract values if
    Criteria 1: extract only values in D2:D14 <=15
    Criteria 2: extract only values in D2:D14 >=16

    See attached file

    Thanks
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-05-2015
    Location
    Manchester, UK
    MS-Off Ver
    2016
    Posts
    94

    Re: Extract values based on two (2) criteria

    Does this work for you? Make sure you hit refresh all on the data tab after you add any new lines of data to the table.

    Extract Values.two.Criteria..xlsx

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Extract values based on two (2) criteria

    ARRAY FORMULA

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    -- Array(CSE) { }, formulae are confirmed with Control+Shift+Enter.
    Not just Enter.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

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

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values based on two (2) criteria

    Fotis1991 : the formula works for <=15 but does not work for >=16. Can you take a look pls?

    Thanks

  5. #5
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Extract values based on two (2) criteria

    <=15
    In Cell F5
    =IF(ROWS(A$1:A1)>COUNTIF($D$2:$D$14,"<="&$G$1),"",INDEX($A$2:$A$14,SMALL(INDEX(($D$2:$D$14<=$G$1)*(ROW($A$2:$A$14)-ROW($A$2)+1),),COUNTIF($D$2:$D$14,">"&$G$1)+ROWS(A$1:A1))))

    Copy down as far as desired

    >=16
    In Cell F18
    =IF(ROWS(A$1:A1)>COUNTIF($D$2:$D$14,">="&$H$1),"",INDEX($A$2:$A$14,SMALL(INDEX(($D$2:$D$14>=$H$1)*(ROW($A$2:$A$14)-ROW($A$2)+1),),COUNTIF($D$2:$D$14,"<"&$H$1)+ROWS(A$1:A1))))

    Copy down as far as desired

    Both are non-array (standard) formulas
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  6. #6
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values based on two (2) criteria

    Ace_XL: great work - if there a way I can have 15 and 16 in a drop down and have one formula extract these values? See attached

    Thanks

  7. #7
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values based on two (2) criteria

    Excel book added
    Attached Files Attached Files

  8. #8
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Extract values based on two (2) criteria

    Aah I see..

    Cell F5 remains same i.e.
    =IF(ROWS(A$1:A1)>COUNTIF($D$2:$D$14,"<="&$G$1),"",INDEX($A$2:$A$14,SMALL(INDEX(($D$2:$D$14<=$G$1)*(ROW($A$2:$A$14)-ROW($A$2)+1),),COUNTIF($D$2:$D$14,">"&$G$1)+ROWS(A$1:A1))))

    Copied down

    F18 becomes
    =IF(ROWS(A$1:A1)>COUNTIF($D$2:$D$14,">"&$G$1),"",INDEX($A$2:$A$14,SMALL(INDEX(($D$2:$D$14>$G$1)*(ROW($A$2:$A$14)-ROW($A$2)+1),),COUNTIF($D$2:$D$14,"<="&$G$1)+ROWS(A$1:A1))))

    Copied down

  9. #9
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values based on two (2) criteria

    Ace_XL: want it to show >=16 in cell F5:F15 if I select 16 from the drop down instead of a second formula from F18 and coping down. Pretty much nesting the two formulas together and coping down from F5:F15.

    Thanks

  10. #10
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Extract values based on two (2) criteria

    Ok, if I've understood this correctly there are only two option sin the drop-down 15 & 16 and you want differing results based on what is selected

    Try
    =IF(ROWS(A$1:A1)>COUNTIF($D$2:$D$14,IF($G$1=15,"<=",">")&$G$1),"",INDEX($A$2:$A$14,SMALL(IF($G$1=15,INDEX(($D$2:$D$14<=$G$1)*(ROW($A$2:$A$14)-ROW($A$2)+1),),INDEX(($D$2:$D$14>$G$1)*(ROW($A$2:$A$14)-ROW($A$2)+1),)),COUNTIF($D$2:$D$14,IF($G$1=15,">","<=")&$G$1)+ROWS(A$1:A1))))

  11. #11
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values based on two (2) criteria

    Ace_XL: great work friend! Works like a charm! Thanks a million

+ 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. Extract values based on two (2) criteria
    By bjnockle in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 07-19-2015, 04:14 AM
  2. Replies: 3
    Last Post: 12-18-2014, 10:27 AM
  3. [SOLVED] Extract Unique Text Values based on Multiple Criteria
    By Kattenhove in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-26-2014, 07:59 AM
  4. [SOLVED] Extract duplicated values based on an extra criteria
    By Eduard in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-21-2013, 05:50 AM
  5. Replies: 1
    Last Post: 02-14-2013, 02:32 PM
  6. [SOLVED] Extract unique values out of list based on an extra criteria
    By sven1975 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-11-2012, 05:02 AM
  7. Extract Unique Values from an Array based on Criteria
    By ronleex324 in forum Excel General
    Replies: 1
    Last Post: 10-04-2011, 06:37 PM

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