Hi
I have this code which isn't working;
In short, it's the parts which are within the Month parenthesis which provide a run-time error '13':type mismatch... (removing it entirely then runs fine but isn't the result I want). And for some reason, I just can't get my head around it.
In Sheets("Support").Range("B1:B12") - this contains the 1st of each month in a dd/mm/yyyy format.
In Sheets("Data").Range("B:B") - this contains random dates of the month, across multiple months, also in a dd/mm/yyyy format.
As part of the above worksheet function, all I'm trying to do is include the parameter to 'countif', if the month within each range is the same... What am I missing? Any help or suggestions would be hugely appreciated.
Thank you
I have this code which isn't working;
VBA Code:
For Each c In Sheets("Support").Range("B2:B13")
c.Value = (Application.WorksheetFunction.Sum(Application.CountIfs(Worksheets("Data").Range("G:G"), Array("6", "7"), Month(Worksheets("Data").Range("B:B")), Month(c.Offset(, -1).Value))) - Application.WorksheetFunction.Sum(Application.CountIfs(Worksheets("Data").Range("G:G"), Array("1", "2", "3"), Month(Worksheets("Data").Range("B:B")), Month(c.Offset(, -1).Value)))) / Application.WorksheetFunction.Sum(Application.CountIfs(Worksheets("Data").Range("G:G"), Array("1", "2", "3", "4", "5", "6", "7"), Month(Worksheets("Data").Range("B:B")), Month(c.Offset(, -1).Value)))
Next
In short, it's the parts which are within the Month parenthesis which provide a run-time error '13':type mismatch... (removing it entirely then runs fine but isn't the result I want). And for some reason, I just can't get my head around it.
In Sheets("Support").Range("B1:B12") - this contains the 1st of each month in a dd/mm/yyyy format.
In Sheets("Data").Range("B:B") - this contains random dates of the month, across multiple months, also in a dd/mm/yyyy format.
As part of the above worksheet function, all I'm trying to do is include the parameter to 'countif', if the month within each range is the same... What am I missing? Any help or suggestions would be hugely appreciated.
Thank you