+ Reply to Thread
Results 1 to 10 of 10

SUMIFS formula that takes first seven of matching criteria from an array

  1. #1
    Registered User
    Join Date
    04-23-2015
    Location
    Kunming, China
    MS-Off Ver
    2013
    Posts
    11

    SUMIFS formula that takes first seven of matching criteria from an array

    Hi,

    I'm trying to use a SUMIFS function with two sets of criteria;
    1. the ID of an operator,
    2. the 7 most recent weeks that this operator was active

    Based on the example below, I essentially want to create a list in which I sum up used Resources (Column C), by a particular Operator (Column A), in the most recent 7 actions based on the week of occurence (Column B).

    This has to be a dynamic formula (everything is variable) as I'm dealing with over 200 ID's and 4 more phases of which I need to sum these resources up.

    I've got something like =SUMIFS(C:C,A:A,73,B:B,"<"&$A$1)
    I presume I have to insert an OFFSET(...MATCH(...ROW))) somewhere in the last criteria part of this but I haven't been able to wrap my head around this (4 days non-stop spreadsheet analysis may be the cause I'm overlooking the simple solution here...)

    image.png
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    So... for emplyee 73, is the expected result for resources 2420? If not, what is the expected result and why?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    04-23-2015
    Location
    Kunming, China
    MS-Off Ver
    2013
    Posts
    11

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    Hi Glenn,

    That's correct. However, as I compile more data, this array will move to count from 201517 once this data is added (based on value of cell A1, not by going from empty to a value).

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    Can you clean up the data a bit? There are extraneous bits of text and #REF errors that interfere. See attached.
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    I should have added...

    These are Array Formulas. They're a little different from ordinary formulas in that they MUST be 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 the outside of your formula. If you do not CTRL+SHIFT+ENTER you will get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly braces yourself - it won't work...

  6. #6
    Registered User
    Join Date
    04-23-2015
    Location
    Kunming, China
    MS-Off Ver
    2013
    Posts
    11

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    Hi Glenn,

    Thanks for looking into this. The problem is that the way the list is organized is variable. I continuously need to sort and filter this list which affects the results of the formula if Column B isn't sorted small to large. It should be workable though by simply doing this before extracting the data to analyze.

    The #REFs shouldn't occur; I trimmed the data for the example and may have overlooked a reference to a deleted cell or external file. However the text in column C is essential to work-processes prior to data collection.
    I tried to insert various forms of this into the formula: IFERROR(VALUE(C$3:C$340),"") to omit any cells containing text, but unsuccessfully so. (I entered as an array formula FYI)

    Ideally the formulas could deal with this, but for now I'll copy the data to a new sheet, insert a column with the above formula and use that column for "resources".

    This is very helpful to extract the data I need this week. Thanks!

    ---

    I'll take this a step further; By comparing Produced/Resources I derive a productivity number (in the case of past seven weeks ID 73, 8864/2420=3.66). This is a 7-period, weighed average I use for planning production outcome scenarios. This is easily done using your formula.

    The next step is finding the maximum positive and negative deviations from that average. This is essentially the only thing I'm looking for but the big challenge is that I can't add columns to my list (various non-excel related reasons).
    Now, I'm projecting the 7 most recent productivity numbers in the report sheet and take the MIN and MAX from the 7 period total. I believe there could be a more elegant solution than using 10 columns for each production phase, but it's a good start.

    I've expanded on your formula and attached the example if you would like to elaborate more on this.

    Cheers!
    Attached Files Attached Files

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    OK... I have done two things to this. i see that you used column E to find the last result, presumably 'cos it's text free? On that basis I tidied up your formula a bit to remove the "right" terms. It's easier to use offset's functions to do that. (the intermediate steps are in the Tan cells, in case I need to unpick this. Then I re-read the email and realsied that it was possible to do a one-step solution. So look at the purple table near the top and a bit to the right. Again the green bits are intermediate steps that should be deleted when all is done and dusted.

    However, if that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-23-2015
    Location
    Kunming, China
    MS-Off Ver
    2013
    Posts
    11

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    Thanks Glenn,

    Good advice on the 'right' function alternative.

    I've made the positive and negative deviation formulas a bit lighter by simply subtracting the 7-period average from either the MAX or MIN in that series and then divided by the same average to get the percentage as can be seen below.

    Below an extract of the larger data I'm working with at the moment.

    image.png

    Cheers!

  9. #9
    Registered User
    Join Date
    04-23-2015
    Location
    Kunming, China
    MS-Off Ver
    2013
    Posts
    11

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    I realize this might be difficult to trace from a screenshot:

    =(MIN(OFFSET(INDIRECT(CELL("address",INDEX('Realised amounts'!$R:$R,MAX(($A98='Realised amounts'!$D:$D)*('Realised amounts'!$R:$R>0)*MATCH(ROW('Realised amounts'!$R:$R),ROW('Realised amounts'!$R:$R)))))),0,0,-IF(AB98<7,AB98,7),1))-B98)/B98

    This looks up the data from a new column in the list. It was impossible to work around that considering text or error values anyway, so I added a productivity number to each line.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: SUMIFS formula that takes first seven of matching criteria from an array

    That makes sense!! Thanks for the Reputation...

+ 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] sumproduct Or sumifs on multiple criteria matching day & time
    By tabkaz in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-16-2015, 05:45 AM
  2. [SOLVED] SUMIF or SUMIFS with Array Criteria
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2014, 11:25 AM
  3. [SOLVED] SUMIFS with multiple criteria evaluated against array?
    By opheim in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-07-2013, 09:03 AM
  4. [SOLVED] SUMIFS to match array of Criteria
    By amazinglazers in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-19-2013, 06:25 AM
  5. Help using a list/array as criteria in SUM(SUMIFS())
    By jaredmason in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-15-2012, 08:20 PM

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