ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   sum next two non-empty cells in a range (https://www.excelbanter.com/excel-worksheet-functions/8920-sum-next-two-non-empty-cells-range.html)

Spencer Hutton

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.



Jason Morin

=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.


.



All times are GMT +1. The time now is 04:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com