COUNTIF with a twist

Erich Duff

Board Regular
Joined
Apr 20, 2005
Messages
129
OK, I have something I've been fighting with for a bit. I have a column (column E) that has numbers. Basically it's a target for a month (each row is a different month, starting from October 2003 to the present). I need to go back, find the last time the target was 1.8 or greater and count forward the amount of times the target was below 1.8. In other words, I need to count the amount of consecutive months from now backwards that the target was below 1.8. Any help?

Erich
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Erich

Let's assume that your values are in E1:E100. Since you started in Oct 2003 the last cells are still empty, but will be filled one more each month.

Then try:

=COUNT(INDEX(E:E,1+MAX(IF(E1:E100<>"",IF(E1:E100>1.8,ROW(E1:E100))))):E100)
This is an array formula and so MUST be entered with CTRL+SHIFT+ENTER and not just ENTER.

Hope this helps
PGC
 
Upvote 0
I'm glad I was able to help.

I spotted an error in the formula. You say in your post "find the last time the target was 1.8 OR GREATER"

Please replace in the formula >1.8 by >= 1.8

Cheers
PGC
 
Upvote 0

Forum statistics

Threads
1,223,832
Messages
6,174,905
Members
452,590
Latest member
CraiginColorado

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