Multiple INDIRECT within a COUNTIFS

malaki1974

New Member
Joined
Feb 14, 2006
Messages
46
Hello and thank you for looking at this.

I have just started using INDIRECT and am finding it very challenging. I have a couple of use cases. One I have solved, this new one is killing me on syntax.
I am using a dropdown to change a year. When it changes my formula updates to reference a new tab with same rows/columns. Works great.
But I have a similar formula that references the variable sheet name twice and I cannot figure out how to edit to make it work.

=COUNTIF(INDIRECT("'"&B2&"'!$F$2:$F$100"),B20) // works great: b2 is the year/name of sheet, b20 is the name that should be counted in the column F
Here is the troublesome one (it works but I want to also replace sheet explicit name with INDIRECT as in first part of formula
=COUNTIFS(INDIRECT("'"&B2&"'!$F$2:$F$117"),B20,'2021'!D2:D117,D15) // same as above but find the Product type (d15).
How to drop in INDIRECT("'"&B2&"'??? in place of the '2021' ?

Thank you!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Thanks for responding! I tried it before to no avail, hence the post. But I tried it again (see below). The error is also included.
=COUNTIFS(INDIRECT("'"&B2&"'!$F$2:$F$117"),B17,INDIRECT("'"&B2&"'!D2:D117",D15))
Error:
Error COUNTIFs expects all arguments after position 2 to be in pairs
 
Upvote 0
You almost have it, just one of the closing brackets in the wrong place, try
Excel Formula:
=COUNTIFS(INDIRECT("'"&B2&"'!$F$2:$F$117"),B17,INDIRECT("'"&B2&"'!D2:D117"),D15)
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

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