+ Reply to Thread
Results 1 to 12 of 12

Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

  1. #1
    Registered User
    Join Date
    01-24-2013
    Location
    okc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Angry Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    I'm just trying to do a sum a column based on the lowest X values in that column. I can do it below, but I don't want to do the {1,2,3,4...}.... instead I'm looking for the cumulative of the lowest X values that would do the same thing.

    The X would be in a separate column, and I'd want it to add cumulatively the lowest 5 values, or 10 values or 4 values.... whatever a 3rd column h

    =SUM(LARGE($C$4:$C$20,{1,2,3,4,5,6,7,8,9,10}))

    For example, I would write =SUMIFS(C:C,A:A,13, -TOP X Values, in this case 3-....

    The X would be a value someone on the sheet. I hope I'm explaining this correctly, as I feel it should be simple. Essentially I want to make this formula, =SUM(LARGE($C$4:$C$20,{1,2,3,4,5,6,7,8,9,10})) , but instead of typing 1,2,3,4,5,6,7,8,9,10 just tell it to sum cumulatively the top 10 or lowest 10. And that number (10) would need to be taken from a cell on the sheet, as it won't ALWAYS be 10. It could be different variables.

    Product ID Date Quantity Sold Days to Sum
    13 4/01/2015 2 3
    13 4/02/2015 1 3
    13 4/03/2015 0 3
    13 4/04/2015 8 3
    13 4/05/2015 21 3

  2. #2
    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,929

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    Hi, welcome to the forum

    Perhaos something like this...
    =SUMIFS(C:C,A:A,13,H:H,"<="&small(H:H,5))
    (you could put the 5 in it's own cell and reference, if you want)

    If you still have a problem, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    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

  3. #3
    Registered User
    Join Date
    01-24-2013
    Location
    okc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    Thank you, but the small and large won't work because it just returns the 5th value in this case. I want the sum of those values, not just the 5th one. (the 1st,2nd,3rd,4th,5th all together).

  4. #4
    Registered User
    Join Date
    01-24-2013
    Location
    okc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    I've attached a clean workbook as requested.

    Sum Column C if Column A = 13, and give me the top X Values, where X is Column D
    This would give me the sum of column C for Product ID 13 for the firsr 6 days

    This would be 34
    Attached Files Attached Files

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    Quote Originally Posted by ryan0000 View Post
    Thank you, but the small and large won't work because it just returns the 5th value in this case. I want the sum of those values, not just the 5th one. (the 1st,2nd,3rd,4th,5th all together).
    That's what the formula does.

    =SUMIFS(C:C,A:A,13,H:H,"<="&small(H:H,5))

    Note that the criteria is <= the 5th smallest number. So, that includes small {1,2,3,4,5}.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    Quote Originally Posted by ryan0000 View Post
    Thank you, but the small and large won't work because it just returns the 5th value in this case. I want the sum of those values, not just the 5th one. (the 1st,2nd,3rd,4th,5th all together).
    Perhaps you missed the "<="&....part?

    edit: Thanks Tony, beat me to it

  7. #7
    Registered User
    Join Date
    01-24-2013
    Location
    okc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    So, first off thank you both it does work that way (i knew it had to be easier).... but I can't seem to do it for dates.

    Now I could find a convoluted way of making 4/1/15 = 1, and 4/2/15 = 2 and do it that way (I test it and it works..), but is there a way to do it SMALL with a column of dates (column B in my file)? If so I should have everything I need!

    Thanks guys

  8. #8
    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,929

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    What you need to understand about dates and times in excel is...

    a date is just a number representing the number of days passed since 1/1/900...and then formated in a way that we recognise as a date. So, for instance, today (Sun Jul 2015) is actually 42197

    Time is actually a decimal part of 1 (day), so 06:00 AM is 0.25, 12 noon is 0.5 and 18:00 (or 6 PM) is 0.75

    You could perhaps somehow build DAY(cellref)<=5 into that

    upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.

  9. #9
    Registered User
    Join Date
    01-24-2013
    Location
    okc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    So, your day idea worked; up to a point.


    The problem is when you fill that down past a new product ID, where there are multiple day 1's (4/1/15), and day 2's, (4/2/15), etc.

    I've attached it, but It seems the sum of large(x) breaks down within the Sumifs when you have multiple ID's.

    The first Result should be 34, and the 2nd should be 55.

    (attached)
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,555

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    You may want to take a look at this, it relies heavily on FDibbins' formula, slightly modified to make allowance for the duplicate dates by using a helper column.

    Summing sales.xlsx

    Hope this helps

  11. #11
    Registered User
    Join Date
    01-24-2013
    Location
    okc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    Clever.

    That will work, and is dynamic enough for me to use it for this massive project.

    Thank you all for your help on this; great community.

    Ryan

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,555

    Re: Sumifs Formula to Sum B:B, based on the earliest X amount of C:C (date column)

    Your Welcome and thanks for the feedback. Please mark the thread "Solved" and add to the reputation of anyone (esp. FDibbins who did the heavy lifting) who helped.

+ 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. LookUp based earliest date (2007)
    By D_N_L in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-15-2012, 08:19 AM
  2. Earliest Date in Column
    By bh2 in forum Excel General
    Replies: 1
    Last Post: 02-14-2012, 10:47 AM
  3. Finding the 'earliest' date in Column C for a list of names in Column A....
    By somethingliketh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2011, 10:01 AM
  4. Find earliest date based on certain criteria
    By SeanKosmann in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 01-26-2010, 11:32 AM
  5. Find Earliest Date based on conditions
    By ShredDude in forum Excel General
    Replies: 6
    Last Post: 07-14-2007, 01:56 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