Dec 06 2021 07:25 AM - edited Dec 06 2021 07:26 AM
Hi, I'm building a spreadsheet which uses a lot of COUNTIF Formulas. The workbook has one sheet with formulas, one sheet with data for year 1, and one sheet with data for year 2.
When I run a formula based on Year 2, it works great. You will see I'm using Column Names in my formula.
=COUNTIFS(Registration_Type,"Delegate",Sales_Method,"",Job_Function,"*FE501*",Order_Status,"<>Cancelled",Del_Rev___Office_Currency,">0",Provisional?,"N")
However, when I run an equivalent formula on Year 1, I get an error when I add in one of the COUNTIF criteria. Yet running this error prone COUNTIF formula on it's own does not give me an error. i.e. the error only occurs when I nest this formula in the COUNTIF with other criteria.
So this works on it's own:
=COUNTIF(Job_Function_PY,"<>*FE501*")
This works (which excludes the above):
=COUNTIFS(Registration_Type_Prev_Yr,"Delegate",Sales_Method_Prev_Yr,"",Order_Status_Prev_Yr,"<>Cancelled",Del_Rev___Office_Currency_Prev_Yr,">0")
But when I next them together, I get an error. I can't get my head around it.
=COUNTIFS(Registration_Type_Prev_Yr,"Delegate",Sales_Method_Prev_Yr,"",Order_Status_Prev_Yr,"<>Cancelled",Del_Rev___Office_Currency_Prev_Yr,">0",Job_Function_PY,"<>*FE501*")
I've never heard of an error where certain COUNTIF criteria work fine apart but can't be combined. Can anyone help?!
In the attached I've highlighted 4 cells with formula issues like this in yellow. 2 are working (working from data in the Current Orders sheet), 2 aren't (working from data in the prev year Orders sheet)
Thanks
Will
Dec 06 2021 07:56 AM
The defined names don't have the same size.
Registration_Type_Prev_Yr and Sales_Method_Prev_Yr refer to rows 2:1048576, but Job_Function_PY refers to an entire column (i.e. 1:1048576). Modify Job_Function_PY to refer to rows 2:1048576 too.
Dec 06 2021 08:33 AM
@Hans Vogelaar this is true and thank-you for spotting! However, that's one of the things I tried adjusting and it didn't fix it sadly. So I don't think it can be the cause :(
Dec 06 2021 08:56 AM
Dec 06 2021 09:13 AM
Dec 06 2021 09:24 AM