+ Reply to Thread
Results 1 to 4 of 4

sum next two non-empty cells in a range

  1. #1
    Spencer Hutton
    Guest

    sum next two non-empty cells in a range

    is there a way to tell excel to sum the next two non-empty cells in a range?

    A1 = 5
    A2 = ""
    A3 = ""
    A4 = 4
    A5 = ""

    A1 = 5
    A2 = 4
    A3 = ""
    A4 = 7
    A5 = ""

    if i wanted to evaluate A1:A5, and add only the first two non-empty cells,
    so either way, the formula would return the result of 9. TIA.



  2. #2
    Domenic
    Guest

    Re: sum next two non-empty cells in a range

    Try the following array formula that needs to be confirmed with
    CONTROL+SHIFT+ENTER...

    =SUM(SUBTOTAL(9,OFFSET(A1,SMALL(IF(A1:A5<>"",ROW(A1:A5)-CELL("row",A1)),{
    1,2}),0)))

    Hope this helps!

    In article <[email protected]>,
    "Spencer Hutton" <[email protected]> wrote:

    > is there a way to tell excel to sum the next two non-empty cells in a range?
    >
    > A1 = 5
    > A2 = ""
    > A3 = ""
    > A4 = 4
    > A5 = ""
    >
    > A1 = 5
    > A2 = 4
    > A3 = ""
    > A4 = 7
    > A5 = ""
    >
    > if i wanted to evaluate A1:A5, and add only the first two non-empty cells,
    > so either way, the formula would return the result of 9. TIA.


  3. #3
    Max
    Guest

    Re: sum next two non-empty cells in a range

    Just another option to try:

    Assuming source range is in col A, A1 down

    Put in say, B1:

    =SUM(OFFSET($A$1,,,SMALL(IF(A1:A10<>"",ROW(A1:A10)),{2})))

    Array-enter the formula
    i.e. press CTRL+SHIFT+ENTER
    instead of just pressing ENTER

    Adapt to suit
    --
    Rgds
    Max
    xl 97
    ---
    GMT+8, 1° 22' N 103° 45' E
    xdemechanik <at>yahoo<dot>com
    ----
    "Spencer Hutton" <[email protected]> wrote in message
    news:[email protected]...
    > is there a way to tell excel to sum the next two non-empty cells in a

    range?
    >
    > A1 = 5
    > A2 = ""
    > A3 = ""
    > A4 = 4
    > A5 = ""
    >
    > A1 = 5
    > A2 = 4
    > A3 = ""
    > A4 = 7
    > A5 = ""
    >
    > if i wanted to evaluate A1:A5, and add only the first two non-empty cells,
    > so either way, the formula would return the result of 9. TIA.
    >
    >




  4. #4
    Jason Morin
    Guest

    Re: sum next two non-empty cells in a range

    =SUM(OFFSET(A1,,,SMALL(IF(A1:A5<>"",ROW(A1:A5)),2)))

    Array-entered.

    HTH
    Jason
    Atlanta, GA

    >-----Original Message-----
    >is there a way to tell excel to sum the next two non-

    empty cells in a range?
    >
    >A1 = 5
    >A2 = ""
    >A3 = ""
    >A4 = 4
    >A5 = ""
    >
    >A1 = 5
    >A2 = 4
    >A3 = ""
    >A4 = 7
    >A5 = ""
    >
    >if i wanted to evaluate A1:A5, and add only the first two

    non-empty cells,
    >so either way, the formula would return the result of

    9. TIA.
    >
    >
    >.
    >


+ 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