+ Reply to Thread
Results 1 to 4 of 4

SUM last 6 cells with data (ignoring blanks in between)

  1. #1
    Registered User
    Join Date
    07-15-2014
    Location
    Wales
    MS-Off Ver
    2013
    Posts
    3

    SUM last 6 cells with data (ignoring blanks in between)

    Hi All,

    I'm really stuck on this formula and hope someone can make my Friday a happy one

    I want to count back the last 6 cells in column S which has data (ignoring any blank cells) and add them up.

    My data is ranging betwen S62:S143 (with S144 being the cell that I want to show the total for the last 6 cells with data). I have column headings and various other bits of data from S1:S61 that I want to exclude completely but need to keep for historical purposes.

    Here is an example of some of the data in column S:

    56
    BLANK CELL
    BLANK CELL
    BLANK CELL
    45
    34
    BLANK CELL
    BLANK CELL
    37
    BLANK CELL
    BLANK CELL
    42
    BLANK CELL
    46
    49
    BLANK CELL
    BLANK CELL
    36
    35

    This is my formula so far:

    =SUM(OFFSET(S62,0,0,COUNTA(S62:S143)))

    I have tried adding a negative and positive number on the end of the COUNTA formula but all it does is count all the cells within that given heigh range, not a specific number of cells with data.

    I'm open to suggestions and don't specifically need to use SUM. As long as I get a total.

    Any help would be really appreciated.

    Thanks,

    Chris

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUM last 6 cells with data (ignoring blanks in between)

    Hello Chris,

    Assuming you have at least 6 numbers in that range this "array formula" can be used to sum the last 6

    =SUM(INDEX(S62:S143,LARGE(IF(S62:S143<>"",ROW(S62:S143)-ROW(S62)+1),6)):S143)

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM last 6 cells with data (ignoring blanks in between)

    Quote Originally Posted by daddylonglegs View Post
    Hello Chris,

    Assuming you have at least 6 numbers in that range this "array formula" can be used to sum the last 6

    =SUM(INDEX(S62:S143,LARGE(IF(S62:S143<>"",ROW(S62:S143)-ROW(S62)+1),6)):S143)

    confirmed with CTRL+SHIFT+ENTER
    Very nice. I guess we could also make a non-CSE AGGREGATE version since the OP has Excel 2013:

    =SUM(INDEX(S62:S143,AGGREGATE(14,6,(ROW(S62:S143)-ROW(S62)+1)/(S62:S143<>""),6)):S143)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Registered User
    Join Date
    07-15-2014
    Location
    Wales
    MS-Off Ver
    2013
    Posts
    3

    Re: SUM last 6 cells with data (ignoring blanks in between)



    Thanks guys!! You really have put a smile on my face for a Friday afternoon!

    Really appreciate your hard work and quick responses!

+ 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. sum cells ignoring ones with blanks
    By kiwiingrid in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-04-2012, 06:03 PM
  2. copy cells ignoring blanks
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2011, 10:35 AM
  3. Average ignoring Blanks cells
    By Justinmih in forum Excel General
    Replies: 10
    Last Post: 09-30-2011, 06:21 PM
  4. Replies: 5
    Last Post: 12-02-2010, 01:10 PM
  5. Excel 2007 : sum cells ignoring blanks and text
    By mickurje in forum Excel General
    Replies: 2
    Last Post: 07-04-2010, 03:00 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