COUNTIFS Function

Tikey

Board Regular
Joined
Jan 30, 2014
Messages
148
Office Version
  1. 2021
Platform
  1. Windows
I am using the following formula to count the number of occurences of a date so long as a value in a corresponding column is >0.


=COUNTIFS(Records!$F$2:$F$40000,">=1992-1-1",Records!$F$2:$F$40000,"<1993-1-1",Records!$I$2:$I$40000,">0")

This works fine, but I wish to expand the range which needs to be >0 to include a further 2 columns - Records!$I$2:$K$40000. If I do this I get a #VALUE ! error.

Can anyone offer a soultion to this, any help appreciated.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Untested, but you can try:
Code:
=COUNTIFS(Records!$F$2:$F$40000,">=1992-1-1",Records!$F$2:$F$40000,"<1993-1-1",Records!$I$2:$I$40000,">0",Records!$J$2:$J$40000,">0",Records!$K$2:$K$40000,">0")
 
Upvote 0
Untested, but you can try:
Code:
=COUNTIFS(Records!$F$2:$F$40000,">=1992-1-1",Records!$F$2:$F$40000,"<1993-1-1",Records!$I$2:$I$40000,">0",Records!$J$2:$J$40000,">0",Records!$K$2:$K$40000,">0")


Thanks for the reply. Since posting I have tried this but it requires a value >0 in all 3 columns I,J,K before it will count. It needs to count when there is a value of >0 in any of the 3 columns.
 
Upvote 0
Thanks for the reply. Since posting I have tried this but it requires a value >0 in all 3 columns I,J,K before it will count. It needs to count when there is a value of >0 in any of the 3 columns.
That wasn't clear from your prior post. See if this does what you want:
Code:
=SUMPRODUCT((Records!$F$2:$F$40000>=1992-1-1)*(Records!$F$2:$F$40000<1993-1-1)*((Records!$I$2:$I$40000>0)+(Records!$J$2:$J$40000>0)+(Records!$K$2:$K$40000>0)))
 
Upvote 0
Thanks again for your reply, unfortunately that doesn't work either.
 
Upvote 0
@ JoeMo

You still need to double quote the date specs and coerce...

=SUMPRODUCT((Records!$F$2:$F$40>="1992-1-1"+0)*(Records!$F$2:$F$40<"1993-1-1"+0)*((Records!$I$2:$I$40>0)+(Records!$J$2:$J$40>0)+(Records!$K$2:$K$40>0)))
 
Upvote 0
Thanks for the reply, but this is summing all the values in the I,J &K columns.

Please see the start of the thread which hopefully highlights what I am trying to achieve.
 
Upvote 0
@ JoeMo

You still need to double quote the date specs and coerce...

=SUMPRODUCT((Records!$F$2:$F$40>="1992-1-1"+0)*(Records!$F$2:$F$40<"1993-1-1"+0)*((Records!$I$2:$I$40>0)+(Records!$J$2:$J$40>0)+(Records!$K$2:$K$40>0)))
Good catch Aladin, thanks.
 
Upvote 0
Thanks for the reply, but this is summing all the values in the I,J &K columns.

Please see the start of the thread which hopefully highlights what I am trying to achieve.
OK that's different from what I was addressing. Try this array formula and be sure to confirm using ctrl+shift+enter.
Code:
=SUM(IF((Records!$F$2:$F$40>="1992-1-1"+0)*(Records!$F$2:$F$40<"1993-1-1"+0)*((Records!$I$2:$I$40>0)+(Records!$J$2:$J$40>0)+(Records!$K$2:$K$40>0)),1,0))
 
Upvote 0
Cheers, that's now working, thank you for all your time and effort on this.

You may be a little older, but you still know a lot.
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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