Type Mismatch error - can't see it

Bagharmin

Board Regular
Joined
Nov 22, 2010
Messages
168
My code is giving me a Type Mismatch error on a particular line and I can't see why. The code in question is below.

Code:
With Worksheets("Employees")
                TotalActive = .Evaluate("SUMPRODUCT((" & AllCodes.Address & "=" & Chr(34) & CodeNumber & Chr(34) & ")*(" & EEHires.Address & "<" & EndDate & _
                    ")*(" & EETerms.Address & ">" & StartDate & "))")
            End With

Sorry for the poor formatting.

In looking at it, AllCodes.Address is "$D$3:$D$22899" and CodeNumber is actually in column D and is "0005". All entries in column D are text. EEHires.Address is "$L$3:$L$22899" and EETerms.Address is "$M$3:$M$22899" while EndDate is 40603 (3/1/2011 on the sheet) and StartDate is 40237 (2/28/2010 on the sheet).

CodeNumber is Dim'd as Variant while TotalActive, EndDate, and StartDate are all Double. Can anyone tell by looking where the Type Mismatch is coming from?

Thank you.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Does this work?
Code:
TotalActive = Evaluate("SUMPRODUCT((Employees!" & AllCodes.Address & "=" & Chr(34) & CodeNumber & Chr(34) & ")*(Employees!" & EEHires.Address & "<" & EndDate & _
                    ")*(Employees!" & EETerms.Address & ">" & StartDate & "))")
Hope that helps.
 
Upvote 0
Wow! Thanks for the quick response. But I found the error. Turns out, in the AllCodes.Address range I had two cells with "#VALUE" in them. I corrected that and it worked fine. I should have checked that first thing.

I really need to start drinking more caffeine.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,876
Members
452,949
Latest member
Dupuhini

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