Count until change in value, then reset, and sum, please -

aiki100

Board Regular
Joined
Aug 16, 2016
Messages
102
Hello -

Thanks for any and all help on this!

Basically, I need some help please on how many times a value in BS occurs in a sequence. And then, if the value occurs again, to know the sum of the new sequence.


(To start, for clarity: COL BS in the example below is being pulled from COL AG in my real worksheet. SO BS = AG in the code example, thx...)

OK -- I am trying to count the number of occurrences that repeat in COL BS, until the repeated value changes.

At the point that it changes, the count (of the new value) should start from 1.

If the next change in value is equal to a previous value, the count should start (again) from 1.

In the example below, you can see that for one thing:

A) BR3 should be the start of the count (1), as BS3 = BS2. I don't know why that is incorrect, please...and:

B) that the formula DOES count until the change in value, but when it changes again, back to a previous value, it picks up counting where it left off. I would like it to reset at each value change.

(Ideally, I do not need to see the individual count, but only the sum, in COL BR. But is not a problem if it is difficult to arrange.)


Thank you all for your insight - much appreciated!


Excel 2016 (Mac) 32 bit
BRBS
2FALSEdown
3FALSEdown
43down
54down
65down
76down
87down
98down
101up
112up
123up
134up
145up
156up
167up
178up
189up
1910up
2011up
2112up
2213up
239down
2414up
2515up
2616up
2717up
2818up
2919up

<tbody>
</tbody>
Main

Worksheet Formulas
CellFormula
BR2=IF([COLOR=rgb(255]A2=A1,COUNTIF(AG$2:AG2,AG2)[/COLOR])
BS2=AG2
BR3=IF([COLOR=rgb(255]A3=A2,COUNTIF(AG$2:AG3,AG3)[/COLOR])
BS3=AG3
BR4=IF([COLOR=rgb(255]A4=A3,COUNTIF(AG$2:AG4,AG4)[/COLOR])
BS4=AG4
BR5=IF([COLOR=rgb(255]A5=A4,COUNTIF(AG$2:AG5,AG5)[/COLOR])
BS5=AG5

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Like this, copied down?

Excel Workbook
BRBS
1
21down
32down
43down
54down
65down
76down
87down
98down
101up
112up
123up
134up
145up
156up
167up
178up
189up
1910up
2011up
2112up
2213up
231down
241up
252up
263up
274up
285up
296up
Count
 
Upvote 0
Peter -

Thank you so much! That worked just great -

I very much appreciate your help...


Now, a follow on question please:

Is it possible to have a column BT, that will show the highest result from the string of occurrences before it starts from 1 again?

so:

BT9 = 8
BT22 = 13
BT23 = 1
BT29 = 6


Again, thank so much for your insight - it is much appreciated!
 
Upvote 0
Peter -

Thank you so much! That worked just great -

I very much appreciate your help...
You are very welcome.


Now, a follow on question please:

Is it possible to have a column BT, that will show the highest result from the string of occurrences before it starts from 1 again?

so:

BT9 = 8
BT22 = 13
BT23 = 1
BT29 = 6
Sure ..

Excel Workbook
BRBSBT
1
21down 
32down
43down
54down
65down
76down
87down
98down8
101up
112up
123up
134up
145up
156up
167up
178up
189up
1910up
2011up
2112up
2213up13
231down1
241up
252up
263up
274up
285up
296up6
Count
 
Upvote 0
Peter -

Outstanding, thank you!

I do very much appreciate the assist and now see how that was done.

Hope you have a great day where you are -

Thx
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,681
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top