+ Reply to Thread
Results 1 to 8 of 8

Sum specific number Non Blank Cells

Hybrid View

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Sum specific number Non Blank Cells

    Hi Guys
    I have a little project that I have been working on and I can't figure out how to sum the 12 largest of last 14 non blank cells
    My excel is set up as follows.

    A B C
    1 9/1/2012
    2 9/2/2012
    3 9/3/2012
    4 9/4/2012 720.79
    5 9/5/2012
    6 9/6/2012 1080.88
    7 9/7/2012 1560.56
    8 9/8/2012
    9 9/9/2012
    10 9/10/2012 -440.67
    11 9/11/2012 870.11
    12 9/12/2012 1240.05
    13 9/13/2012 2200.3
    14 9/14/2012 300.75
    15 9/15/2012
    16 9/16/2012
    17 9/17/2012 -1150.37
    18 9/18/2012 830.87
    19 9/19/2012 1790.84
    20 9/20/2012 4900.82
    21 9/21/2012 2200.43
    22 9/22/2012
    23 9/23/2012
    24 9/24/2012 560.26
    25 9/25/2012 3830.08
    26 9/26/2012 1520.28
    27 9/27/2012 -4650.37
    28 9/28/2012 8310.93
    29 9/29/2012
    30 9/30/2012

    The part that has me stumped is that the ranges sometime change because of blank cells.
    For example
    C27 will use range B10:B27 (18rows because 4 blanks)
    C26 will use range B7:B26 (20rows because 6 blanks)
    C24 will use range B4:B24 (21 rows because 7 blanks)

    I would deeply appreciate any help.

    Thanks,
    tom

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Sum specific number Non Blank Cells

    Please attach a sample workbook with the data and the expected output for our better understanding.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    11-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sum specific number Non Blank Cells

    Hi SixthSense

    Thanks for the prompt response

    I've worked on the a few stuff since yesterday but still stuck with the same problem. I'm trying to figure out the formula for MPP column(E).

    MPP = (SUM of last 14 days) - (2 Worst days)

    Currently, I'm using

    SUM(LARGE(*range*,{1,2,3,4,5,6,7,8,9,10,11,12})) where *range* is something like B2:B21

    but I need to manually change *range* on some cells because of blank cells. Sometimes the range includes more than 14 nonblank cells and sometime the range has fewer than 14 nonblank cells.
    Is there a way to figure out the exact range that include 14 nonblank cells?

    If you have any other questions let me know. Thanks for your help.
    Attached Files Attached Files

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Sum specific number Non Blank Cells

    I could not able to achieve it without a Helper column. So using Column-M as supportive.

    In M2 cell
    Formula: copy to clipboard
    =IF(ISBLANK($B2),"",COUNTA($B$2:$B2))


    In E2 cell - Array Formula - Requires Ctrl+Shift+Enter
    Formula: copy to clipboard
    =IF(ISBLANK($B2),"",IF(COUNT($B$2:$B2)<14,0,SUM(LARGE(IF(($M$2:$M$137>=((COUNT($B$2:$B2)+1)-14))*($M$2:$M$137<(COUNT($B$2:$B2)+1)),$B$2:$B$137),{1,2,3,4,5,6,7,8,9,10,11,12}))))

    Drag it down

    Refer the attached excel for details.
    Attached Files Attached Files
    Last edited by :) Sixthsense :); 11-17-2012 at 02:24 AM. Reason: Formula Tag Applied

  5. #5
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Sum specific number Non Blank Cells

    Hi. I think I figured it without a helper column.
    =SUM(LARGE(OFFSET($E$1,MATCH(LARGE((E2:E500<>"")*(ROW(A2:A500)-1),14),(E2:E500<>"")*(ROW(A2:A500)-1),0),0,MAX((E2:E500<>"")*(ROW(A2:A500)-1))-LARGE((E2:E500<>"")*(ROW(A2:A500)-1),14),1),ROW(1:12)))-SUM(SMALL(OFFSET($E$1,MATCH(LARGE((E2:E500<>"")*(ROW(A2:A500)-1),14),(E2:E500<>"")*(ROW(A2:A500)-1),0),0,MAX((E2:E500<>"")*(ROW(A2:A500)-1))-LARGE((E2:E500<>"")*(ROW(A2:A500)-1),14),1),ROW(1:2)))

    After entering extra numbers to your sheet you should enlarge the range in function too.
    Attached Files Attached Files

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Sum specific number Non Blank Cells

    Try this "array formula" in E2

    =IF(B2,IF(COUNT(B$2:B2)>13,SUM(LARGE(INDEX(B$2:B2,LARGE(IF(ISNUMBER(B$2:B2),ROW(B$2:B2)-ROW(B$2)+1),14)):B2,{1,2,3,4,5,6,7,8,9,10,11,12})),0),"")

    confirmed with CTRL+SHIFT+ENTER and copied down the column
    Audere est facere

  7. #7
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Sum specific number Non Blank Cells

    Hi PhamsO
    I forgot to tell what my formula is about. Maybe that is what you dont want. Formula I put posted above takes last 14 nonblank cells and sums largest 12 - sum smallest 2 numbers.
    I hope that is what you want. If not please correct me

  8. #8
    Registered User
    Join Date
    11-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sum specific number Non Blank Cells

    Hi everyone
    Thank you for your help. The solutions from sixthsense and daddylonglegs worked perfectly.
    I am still trying to understand how your formulas work. I don't know much about array formulas.

    Eisayew. Thanks for you input. I think you misunderstood me. Sorry that I wasn't so clear. I was trying to calculate the formula for MPP (column E) which looks back at the past 14 days (column B) and sums 14 days and minus the 2 worse days. The solution you gave calculated using MPP instead of days. But i think it could of work if the formula was changed to used days.

    Thanks again for everyones help. I really appreciate it.

    Phams0

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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