Can someone help find the Excel formula

ashliiii

Board Regular
Joined
Feb 27, 2011
Messages
69
Suppose I have the cells A1 to A7 filled with the following data:

A1 = 4500
A2 = 5150
A3 = 3120
A4 = 8990
A5 = 6450
A6 = 7770
A7 = 2145

What is the formula I should have in cell B1 when copied to B7, should display as follows:

B1 = 0
B2 = 1
B3 = 0
B4 = 1
B5 = 2
B6 = 3
B7 = 0

That is in when a value in column A cell is more than 5000, column B should add the count by 1 but reset to zero each time value drop below 5000.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
There will probably be many solutions posted for this. But, here is one. It does require starting in Row2, though.
Book2
ABC
1
2450000
3515011
4312000
5899011
6645022
7777033
8214500
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=N(C1)+IF(A2>5000,1,-N(C1))
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
There will probably be many solutions posted for this. But, here is one. It does require starting in Row2, though.
Book2
ABC
1
2450000
3515011
4312000
5899011
6645022
7777033
8214500
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=N(C1)+IF(A2>5000,1,-N(C1))
Thank you for your time.
 
Upvote 0
Some variations.
Book1
ABC
1
2450000
3515011
4312000
5899011
6645022
7777033
8214500
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=SCAN(0,A2:A8,LAMBDA(a,b,(a+1)*(b>=5000)))
B2:B8B2=(B1+1)*(A2>=5000)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,080
Members
453,021
Latest member
Justyna P

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