+ Reply to Thread
Results 1 to 7 of 7

get value for matching criteria

  1. #1
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    get value for matching criteria

    In the attached workbook, i'm trying to sum each weeks quantity produced based upon matching corresponding values from column K in column a. Then locate the maximum line item against matching value from column K that reside in column b.

    The first row L2 thru Q2 seem to work but when copied down (l3 thru Q5) seem to work.

    Any ideas?
    Attached Files Attached Files
    Last edited by jprlimey; 02-28-2015 at 01:25 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: get value for matching criteria

    L2:c5 -->
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    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,936

    Re: get value for matching criteria

    Sounds to me like you want 2 different answers here?

    1, Sum by week by Order Number...
    =SUMIF($A$2:$A$15,$K2,C$2:C$15)

    2. max line item number by order...
    =MAX(IF($A$2:$A$15=K2,$B$2:$B$15,0))
    This 1 is an ARRAY formula...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. Press F2 on that cell and try again.
    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

  4. #4
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: get value for matching criteria

    I tried both solutions but neither did the trick. I added to the workbook what the resulting values should look like.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: get value for matching criteria

    Quote Originally Posted by FDibbins View Post
    Sounds to me like you want 2 different answers here?

    1, Sum by week by Order Number...
    =SUMIF($A$2:$A$15,$K2,C$2:C$15)

    2. max line item number by order...
    =MAX(IF($A$2:$A$15=K2,$B$2:$B$15,0))
    This 1 is an ARRAY formula...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. Press F2 on that cell and try again.
    This is actually close. I need to sum by max line number by Order, by week.

    for example for order number 222345, for week 1 it should return a value of 45, as the max line number is 2. for week 2 it should then return 5.

    Look at it as though your producing widgets and you only wanted count completed widgets. When multiple line items are shown the largest line item number matched to the corresponding order number would represent the last manufacturing step. So essentially i only want to count completed widgets

  6. #6
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: get value for matching criteria

    I solved it, the following as an ARRAY formula does the trick.

    =SUMIFS(C$2:C$15,$A$2:$A$15,$K2,$B$2:$B$15,MAX(IF($A$2:$A$15=$K2,$B$2:$B$15)))
    Thanks for your help Ford

  7. #7
    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,936

    Re: get value for matching criteria

    Awesome, great job, its always a great feeling when you solve stuff like this yourself Sometimes all you need is a nudge in the right direction - thanks for the feedaback

+ 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] Matching 2 Criteria
    By pezalmendra in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-05-2014, 01:03 PM
  2. Replies: 1
    Last Post: 09-03-2013, 07:41 PM
  3. [SOLVED] Return cell values for non-matching & matching criteria
    By jenz_skallemose in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-13-2012, 11:52 AM
  4. [SOLVED] Matching Criteria
    By akbar in forum Excel General
    Replies: 6
    Last Post: 10-12-2011, 04:48 AM
  5. help 2 criteria matching
    By ytja12 in forum Excel General
    Replies: 2
    Last Post: 08-26-2010, 08: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