urgent type 13 mismatch assistance required!

nick_clarke

New Member
Joined
Aug 26, 2010
Messages
27
Hi

I've recently transferred some working vba code from one spreadhseet to another, changing the cell references only to correspond to the new spreadsheet.

The code returns a type 13 mismatch error when I try to run it in the new spreadsheet. It uses evaluate and sumproduct, and I have verified the sumproduct works by entering the formula into a cell.

Below is the code:

e1 = Evaluate("=SUMPRODUCT(('Active Case Tracker'!$T$3:$T$15998>" & twka & " )*('Active Case Tracker'!$T$3:$T$15998<=" & twkb & ")*('Active Case Tracker'!$T$3:$T$15998>'Active Case Tracker'!$Z$3:$Z$15998)*('Active Case Tracker'!$AE$3:$AE$15998=""No Change Of Outcome"")*('Active Case Tracker'!$X$3:$X$15998=""N/A""))")

e1 is a variable that I have declared as an integer, as this was how it was declared in the code for the working spreadsheet.

Any ideas on why I am getting the error message?

My head is starting to hurt from banging it against my desk, any help would be much appreciated.

Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Thanks for the quick response.

I tried changing it to long, double and variant, and still got the same type 13 mismatch error.

It's weird because I know the sumproduct formula works as I have tested it within a cell. It appears to fail when I put it into VBA.

I forgot to say in my original post that twka and twkb are variables declared as long that hold date values.

Any futher ideas?

Thanks
 
Upvote 0
Hi

The formula on the spreadsheet is this:

=SUMPRODUCT(('Active Case Tracker'!$T$3:$T$15998>J35 )*('Active Case Tracker'!$T$3:$T$15998<=J36)*('Active Case Tracker'!$T$3:$T$15998>'Active Case Tracker'!$Z$3:$Z$15998)*('Active Case Tracker'!$AE$3:$AE$15998="No Change Of Outcome")*('Active Case Tracker'!$X$3:$X$15998="N/A"))

where the formula for J35 is :

=TODAY()-7

and the formula for J36 is:

=TODAY()-1

It works within the cell and returns the correct value.

Thanks
 
Upvote 0
From testing it seems that there are one too many conditions for Evaluate to cope with. It works if you remove any one of them. Sorry I don't know a solution other than putting the formula on a worksheet and returning it's value.
 
Upvote 0
Thanks for your help - I'll try removing one of the conditions from evaluate and testing again.

Fingers crossed it works
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,799
Members
452,943
Latest member
Newbie4296

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