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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,212,938
Messages
6,110,775
Members
448,298
Latest member
carmadgar

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