ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Finding and Adding (https://www.excelbanter.com/excel-worksheet-functions/194273-finding-adding.html)

Rich

Finding and Adding
 
Hi,

Have a problem hopefully I can get some help with. I need a formula to find
the last positive number in a row and then add that and all the numbers that
come after it.

Example:

-10 100 -10 -20 60 -10 -20

I need the formula to locate the 60 and then add 60+(-10)+(-20)

Thanks in advance!

Rich

Niek Otten

Finding and Adding
 
Hi Rich,

Assume your data is in A1:A7
In A2 enter this formula:
=IF(A10,0,A1)
In B2, enter this formula:
=IF(B10,0,A2+B1)
copy this formula to the right as far as you need

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Rich" wrote in message ...
| Hi,
|
| Have a problem hopefully I can get some help with. I need a formula to find
| the last positive number in a row and then add that and all the numbers that
| come after it.
|
| Example:
|
| -10 100 -10 -20 60 -10 -20
|
| I need the formula to locate the 60 and then add 60+(-10)+(-20)
|
| Thanks in advance!
|
| Rich



N Harkawat

Finding and Adding
 

Although not perfect given there could be all positive numbers something on
these lines would give you the result :

=SUM(OFFSET($A$1,MATCH(2,1/(--(A1:A70))),,ROW(A7))) array entered
(ctrl+shift+enter)


"Rich" wrote:

Hi,

Have a problem hopefully I can get some help with. I need a formula to find
the last positive number in a row and then add that and all the numbers that
come after it.

Example:

-10 100 -10 -20 60 -10 -20

I need the formula to locate the 60 and then add 60+(-10)+(-20)

Thanks in advance!

Rich



All times are GMT +1. The time now is 06:00 PM.

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