Logic operator in array section of sum(countifs - ?????

spydey

Active Member
Joined
Sep 19, 2017
Messages
314
Office Version
  1. 2013
Platform
  1. Windows
Can I use logic operators in the array section of a sum(countifs formula?

Example:

=Sum(Countifs(item.range,A3,location.range,B3,date.1.range,{"<"&A1,">"&Eomonth(A1,0)})

A1 is a date, typically the 1st of any given month.

I have tried it and it doesn't seem to work as expected.

Any thoughts, insight, ideas?

Thanks!

-Spydey
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You are trying to enter what is called an "Array Constant". By definition, it can only contain constants. No references or formulas are allowed. To solve your problem, you want to enter 2 separate pairs of date column and criterion, to get your desired result.

That said, your logic looks a little faulty. You're asking for < A1 and > EOMONTH(A1, 0), that will never return anything, because a value can't be both less than and greater than A1.
 
Upvote 0
First, if you are using an array constant, you can only use constants within it. {1,2} or {"cat","dog"}, {"<1",">10"} all are OK, but {"<"&A1,">"&Eomonth(A1,0)} is not, because both of the elements in it are formulas.

Next, depending on what you want your formula to do, there still might be a way to do it. It appears you want to count all the items in the list that are not in the month of the date in A1. This should work:

=Countifs(item.range,A3,location.range,B3) - Countifs(item.range,A3,location.range,B3,date.1.range,">="&A1,date.1.range,"<="&EOMONTH(A1,0))

which counts everything in the range, then subtracts the rows within the given month.

If that doesn't work, then you can usually use SUMPRODUCT instead, which is more flexible, but has a different format, and whole column references are discouraged.
 
Upvote 0
Try this version

=SUMPRODUCT(COUNTIFS(item.range,A3,location.range,B3,date.1.range,IF({1,0},"<"&A1,">"&EOMONTH(A1,0))))
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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