+ Reply to Thread
Results 1 to 8 of 8

Sum/Count based on sequence

  1. #1
    Registered User
    Join Date
    12-23-2015
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Sum/Count based on sequence

    Trying to find a formula that would identify if a unique id hits a particular threshold and if so, I would like it to pull the dollar value from the row in which the threshold is met.
    I need the formula to cumulatively add the amount(column D) and number of line items. If the unique identifier (column A) >= count of 4 and the sum of amount (column D) is >= $400 I would like the formula to pull only the amount where both criteria are met.

    For example in the attached file the unique identifier PAYNE PAYNE-57029-NM has 6 line items and would meet the criteria on the 4th line, therefor the result I'd be looking for would $277.96, ignoring the other amounts after it.
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Sum/Count based on sequence

    Here is one solution using helper columns.

    The *** Columns take advantage of relative cell addressing to get a count or sum of all cells following it. This gets subtracted from the total sum.
    *** Count =COUNTIF($A$2:$A$20,A2) - COUNTIF($A2:A20,A2) +1
    *** Amount =SUMIFS($D$2:$D$20,$A$2:$A$20,A2)-SUMIFS(D2:D$20,A2:A$20,A2)+D2

    Pull sees if an individual line meets or exceeds the criteria.
    Pull =AND(F2>=4,G2>=400)

    Match finds the fist occurrence of True for the Link. =MATCH(A2&H2,$A$1:$A$20&$H$1:$H$20,0) <- Array Formual

    Flag shows the cells that are wanted: those that meet or exceed the requirement and are the first occurrence =AND(H2=TRUE,I2=ROW())
    Attached Files Attached Files

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Sum/Count based on sequence

    Disregard I missed it.

    This is another way if I have interpreted correctly.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 12-27-2015 at 07:10 AM.
    Dave

  4. #4
    Registered User
    Join Date
    12-23-2015
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Re: Sum/Count based on sequence

    Thank, this was very helpful. There are also scenarios where the dollar value criteria is not met until after the count of 4. The current formula provided will not display results in those scenarios? Any thoughts?

    Thanks again
    Ulises

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Sum/Count based on sequence

    Yes. I've been working on this off and on for the past few days. I must say this one is more challenging than if first appears.

    Have you tried dflak's helper columns? When the final one is used to determine the SUMIFS it seems to work at my end under all the situations I tried it on.

    I am still trying to get a single formula or one with one / two helper columns.

  6. #6
    Registered User
    Join Date
    12-23-2015
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Re: Sum/Count based on sequence

    Yes it worked great, my file is around a million rows of data so I was trying to reduce the number of formulas. thanks again for the help.

  7. #7
    Registered User
    Join Date
    12-23-2015
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Re: Sum/Count based on sequence

    These formulas worked great. How does the array formula work?

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Sum/Count based on sequence

    If you mean how does one make a formula an array formula: hold down CTRL-SHIFT and then ENTER. If you mean what does the formula do, then this wiki explains the concept: http://www.utteraccess.com/wiki/inde...Array_Formulas.

+ 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] Count number of cells in sequence
    By cocacrave in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2015, 08:20 PM
  2. Count sequence of data below a determined value
    By Bruno Silva in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 04-25-2013, 01:45 PM
  3. [SOLVED] Creating a sequence based on numbers in one column and adding "01,02..." to a new sequence
    By JCR1968 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2013, 08:06 AM
  4. Replies: 2
    Last Post: 10-11-2012, 02:54 PM
  5. Replies: 11
    Last Post: 11-05-2011, 12:34 PM
  6. Trying to count length of sequence
    By tim_oc in forum Excel General
    Replies: 2
    Last Post: 06-13-2007, 03:37 AM
  7. Count rows not in sequence
    By kamill in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-12-2005, 09:06 AM

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