Values show error when using COUNTIF function on closed workbook.

Jermine

New Member
Joined
Feb 17, 2021
Messages
21
Office Version
  1. 2010
Platform
  1. Windows
Hi there, I need help with thee below issue.

Can someone pls advice on how to amend the below countif formula to array formula?
=COUNTIFS(OFFSET('[2. Duty Roster Email - Feb 2021.xlsx]Feb'!$G$18:$G$45,0,(ROW(CB1)-1)*5),"*-*")

with the said formula, the correct value is showing when the reference workbook is open, but the result will show an error when it is closed.
And after googling online, I found that countif formula does not work when the reference workbook is closed, but an array formula can solve this issue.

However, I failed to get the right one after many tries.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Welcome to MrExcel

Sorry I cannot provide you with a solution, but OFFSET does not work with a closed workbook either
 
Upvote 0
For a closed workbook you need to use SUMPRODUCT. Best guess from trying to decode your current formula without any information as to what it should be doing.
Excel Formula:
=SUMPRODUCT(--ISNUMBER(SEARCH("-",INDEX('[2. Duty Roster Email - Feb 2021.xlsx]Feb'!$18:$45,,(ROW(CB1)-1)*5)+7))))
 
Upvote 0
For a closed workbook you need to use SUMPRODUCT. Best guess from trying to decode your current formula without any information as to what it should be doing.
Excel Formula:
=SUMPRODUCT(--ISNUMBER(SEARCH("-",INDEX('[2. Duty Roster Email - Feb 2021.xlsx]Feb'!$18:$45,,(ROW(CB1)-1)*5)+7))))

Hi Jason, thank you so much for responding.

The purpose of the current formula is to count cell in a range that contains dash "*-*", and in this case, is how many cell in a range that contains dash "*-*" for each date.
while OFFSET *5 is because the width for each date is set to 5.

Not sure if that's a good formula to get the value, but that's what I manage to figure out for now.

Below is the screenshot, and I hope it clarifies.

1613583540082.png
 
Upvote 0
Looks as though Jason has a slight typo (one too many closing brackets) try
Excel Formula:
=SUMPRODUCT(--ISNUMBER(SEARCH("-",INDEX('[2. Duty Roster Email - Feb 2021.xlsx]Feb'!$18:$45,,(ROW(CB1)-1)*5+7))))
 
Upvote 0
Solution
Looks as though Jason has a slight typo (one too many closing brackets) try
Excel Formula:
=SUMPRODUCT(--ISNUMBER(SEARCH("-",INDEX('[2. Duty Roster Email - Feb 2021.xlsx]Feb'!$18:$45,,(ROW(CB1)-1)*5+7))))
That formula works wonderfully now, Thank you Fluff.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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