ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how to count the number of cells it takes to reach a certain sum (https://www.excelbanter.com/excel-worksheet-functions/155688-how-count-number-cells-takes-reach-certain-sum.html)

Oshtruck user

how to count the number of cells it takes to reach a certain sum
 
I have a row of data and it contains numerical values. What I want to be able
to do is put a 1 above one of the values and the cell above the one will
count how many cells back it takes for the sum of the values to get a certain
value.

Ex I want to count how many cells it takes to get to over a sum of 300.

A B C D E F G H I J K
1 8
2 1
3 25 40 55 35 40 60 55 20 15 50 40

since 40+50+15+20+55+60+40+35=315 it takes 8 cells to get over a value of 315

Any help will be great.


Domenic

how to count the number of cells it takes to reach a certain sum
 
I'm not sure how the number 1 comes into play, but see if the following
helps...

=MATCH(TRUE,SUBTOTAL(9,OFFSET(A3:K3,,COLUMNS(A3:K3 )-1,,-(COLUMN(A3:K3)-CO
LUMN(A3)+1)))=315,0)

....confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!

In article ,
Oshtruck user wrote:

I have a row of data and it contains numerical values. What I want to be able
to do is put a 1 above one of the values and the cell above the one will
count how many cells back it takes for the sum of the values to get a certain
value.

Ex I want to count how many cells it takes to get to over a sum of 300.

A B C D E F G H I J K
1 8
2 1
3 25 40 55 35 40 60 55 20 15 50 40

since 40+50+15+20+55+60+40+35=315 it takes 8 cells to get over a value of 315

Any help will be great.



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

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