How to continually count if cell value(s) in a range are greater than x?

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please can someone help me?

My range is C7:C737 and I have a value of 10 in cell C5.

What I would like is to be able to continually count if the values in the range that are greater than the value in C5 but if one value is less or equal then the count goes back to 0.

Also there will be blank cells in the range that will need to be ignored.

Any help would be appreciated.

Thanks

Dan
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,
Thank you for your reply.

It is saying it is missing a parenthesis, any ideas?

Thanks

Dan
 
Upvote 0
Hi,

Unfortunately it's not working, it's not counting the higher values.

Thanks

Dan
 
Upvote 0
Post a few samples of data with the results you want.
 
Upvote 0
2211
11211
2211
11"blank"
12"blank"
11211
11211
111111
112"blank"
Count should be 4Count should be 0Count should be 6

Numbers are just an example and the "blank" cells will have nothing in them.

Hope this helps.

Thanks

Dan
 
Upvote 0
Is it possible to convert the following VBA code into a formula?

VBA Code:
If Range("G7") > Range("C5") Then
Range("G10").Value = Range("G10") + 1
Else
Range("G10").Value = 0
End If

I have this formula in cell G7 as a helper cell to find the last entry
{=INDEX(C:C,MAX((C:C<>"")*(ROW(C:C))))}
 
Upvote 0
If the use of a helper column is acceptable (say,column F), put in F7 and fill down :

=IF(G7="",F6,IF(G7<=C$5,"0",IF((G7>C$5)*((F6="")+(F6=0)),1,F6+1)))

There is probably a way (beyond my knowledge) of avoiding a helper column and with a formula in one cell.
 
Upvote 0
If I understand correctly:

Book1
CDEFGHI
510406
6
72211151514
811211
92211
1011
1112
1211211
1311211
14111111
15112
16
Sheet10
Cell Formulas
RangeFormula
G5:I5G5=IF(INDEX(C:C,G7)<$C$5,0,MAX(FREQUENCY(IF(C7:INDEX(C:C,G7)>$C$5,ROW(C7:INDEX(C:C,G7))),IF((C7:INDEX(C:C,G7)<>"")*(C7:INDEX(C:C,G7)<=$C$5),ROW(C7:INDEX(C:C,G7))))))
G7:I7G7=LOOKUP(9E+307,C:C,ROW(C:C))
Press CTRL+SHIFT+ENTER to enter array formulas.


The G7 formula gets the bottom row of the range. Then the G5 formula should give you the count you're looking for. I just put your other examples in D and E, and dragged the G formulas to the right, to show that the formula works on the 3 examples you gave. Nothing in D, E, H, or I is needed. In fact, you don't even need the G7 formula to be separate, you could incorporate it into the G5 formula, but since it's used 6 times, it'd make that formula quite long. This would be a good use for the new LET function.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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