+ Reply to Thread
Results 1 to 15 of 15

Index to Extract Values based on 2 criteria

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

    Index to Extract Values based on 2 criteria

    Looking for formula to extract values in sheet named Product into Outcome Sheet if the 2 date criteria are met. Would also like a formula to extract values in sheet named Product into the sheet named Outcome_II using values extracted into the sheet named Outcome.

    See sample file.
    Attached Files Attached Files
    Last edited by bjnockle; 06-24-2017 at 10:55 PM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Index, Small, IF to Extract Values based on 2 criteria

    try Pivot Table
    Attached Files Attached Files
    Last edited by sandy666; 06-24-2017 at 09:30 PM. Reason: file updated

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

    Re: Index, Small, IF to Extract Values based on 2 criteria

    Looking for formula and not Pivot.

    Thanks.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Index, Small, IF to Extract Values based on 2 criteria

    no problem, good luck

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Index to Extract Values based on 2 criteria

    For the 1st part, use this, copied down and across...
    =INDEX(Product!$D$4:$O$27,MATCH($A4&" "&$B4&" "&$C4,INDEX(Product!$A$4:$A$27&" "&Product!$B$4:$B$27&" "&Product!$C$4:$C$27,0),0),MATCH(D$3,Product!$D$3:$O$3,0))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Index, Small, IF to Extract Values based on 2 criteria

    For the 2nd 1...
    =INDEX(Product!$D$4:$O$27,MATCH(C$2&" "&$A4&" "&$B4,INDEX(Product!$A$4:$A$27&" "&Product!$B$4:$B$27&" "&Product!$C$4:$C$27,0),0),MATCH(C$3,Product!$D$3:$O$3,0))
    copied down and across

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

    Re: Index to Extract Values based on 2 criteria

    FDibbins: formula not pulling correct values. Noticed that the Year criteria in the Product sheet (B1 and C1) was not used in the formula to extract only 2014 and 2015 values into Outcome sheet. Please check.

    Thanks.

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

    Re: Index, Small, IF to Extract Values based on 2 criteria

    FDibbins: for Outcome_II sheet, formula is returning #N/A values. Please check.

    Thanks.

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

    Re: Index to Extract Values based on 2 criteria

    BOTH formulae give the correct results i.e. match your manual results, GIVEN that that Columns A,B,C (In OUTCOME)and A, B (in OUTCOME II) are pre-defined.

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

    Re: Index to Extract Values based on 2 criteria

    JohnTopley: Columns A, B, C are not predefined in Outcome and Outcome_II. The values in columns A,B, C in Outcome and Outcome_II are to be extracted in these columns. For the Outcome sheet, the two criteria for the formula to pull year 2014 and 2015 are in B1 and C1 of Product.

    Thanks.

  11. #11
    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,199

    Re: Index to Extract Values based on 2 criteria

    For "Outcome"

    in A4

    =IFERROR(INDEX(Product!B$4:B$27,SMALL(IF((Product!$B$1=Product!$A$4:$A$27)+(Product!$C$1=Product!$A$4:$A$27),ROW(Product!$A$4:$A$27)-ROW($A$4)+1,""),ROWS($A$4:B4))),"")

    ...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.

    copy down

    I'll look at "Outcome II" .
    Last edited by JohnTopley; 06-25-2017 at 12:56 PM.

  12. #12
    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,199

    Re: Index to Extract Values based on 2 criteria

    In "Column II"

    in A4

    =IFERROR(INDEX(Product!B$4:B$27,SMALL(IF(Product!$B$1=Product!$A$4:$A$27,ROW(Product!$A$4:$A$27)-ROW($A$4)+1,""),ROWS($A$4:B4))),"")

    ...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.

    Copy across and down

    In C3

    =DATE(Product!$B$1,COLUMNS($C:C),1)

    Copy across: format cells as"mmm"

    in C2

    =C3

    Copy across: format cells as "yyyy"

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Index to Extract Values based on 2 criteria

    Quote Originally Posted by bjnockle View Post
    FDibbins: formula not pulling correct values. Noticed that the Year criteria in the Product sheet (B1 and C1) was not used in the formula to extract only 2014 and 2015 values into Outcome sheet. Please check.

    Thanks.
    All your criteria are being used...A4 and B4 and C4 for teh row and D3 for the column...
    =INDEX(Product!$D$4:$O$27,MATCH($A4&" "&$B4&" "&$C4,INDEX(Product!$A$4:$A$27&" "&Product!$B$4:$B$27&" "&Product!$C$4:$C$27,0),0),MATCH(D$3,Product!$D$3:$O$3,0))

    The results I got where identical to every sample answer you gave. If you enter the formula as I provided, it replicates your answers

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Index, Small, IF to Extract Values based on 2 criteria

    Quote Originally Posted by bjnockle View Post
    FDibbins: for Outcome_II sheet, formula is returning #N/A values. Please check.

    Thanks.
    Again, my results match exactly what your sample answers are. If your actual data table structure is different to your sample, update the sample please

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Index to Extract Values based on 2 criteria

    Quote Originally Posted by bjnockle View Post
    ....The values in columns A,B, C in Outcome and Outcome_II are to be extracted in these columns....
    aahh well you didnt say that in your 1st post, did you?
    lol

+ 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] Extract values based one criteria
    By bjnockle in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-10-2016, 10:47 AM
  2. [SOLVED] Extract values based on two (2) criteria
    By bjnockle in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-07-2015, 04:58 PM
  3. [SOLVED] Extract values based on three (3) criteria
    By bjnockle in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-23-2015, 02:30 PM
  4. Extract values based on two (2) criteria
    By bjnockle in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 07-19-2015, 04:14 AM
  5. [SOLVED] Extract values based on two (2) criteria
    By bjnockle in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-18-2015, 05:10 AM
  6. Replies: 1
    Last Post: 02-14-2013, 02:32 PM
  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