Date issue with SUMPRODUCT

Human_doing

Board Regular
Joined
Feb 16, 2011
Messages
137
Hi all,

I can get sumproduct to work in this case:

=SUMPRODUCT(--(B2:B349="COMPLETED"),--(C2:C349="CAT"))

Where one entry is returned, which is correct (I tried this for test purposes) but when it comes to using dates it doesn't seem to work - if I put in

=SUMPRODUCT(--(B2:B349="COMPLETED"),--(C2:C349="01/01/2011"))

When there should be one result, it comes back as 0 results. Can anyone amend the formula or explain why there seems to be a difference when it comes to using this for dates?

Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Untested:
change to
=SUMPRODUCT(--(B2:B349="COMPLETED"),--(C2:C349=DATE(2011,1,1))
 
Upvote 0
Thanks, can you please help with altering the formula so that in vba all used rows are selected and the criteria are 1 = 'COMPLETED' in column B and 2. date in column C has already passed?

I've tried =SUMPRODUCT(--(B2:B" & LRTotal & "=""COMPLETED""),--(C2:C" & LRTotal & "=""NOW()""<1))" but no success, any help much appreciated,

Thanks
 
Upvote 0
Thanks, can you please help with altering the formula so that in vba all used rows are selected and the criteria are 1 = 'COMPLETED' in column B and 2. date in column C has already passed?

I've tried =SUMPRODUCT(--(B2:B" & LRTotal & "=""COMPLETED""),--(C2:C" & LRTotal & "=""NOW()""<1))" but no success, any help much appreciated,

Thanks

In a worksheet formula it would be


=SUMPRODUCT(--(B2:B349="COMPLETED"),--(C2:C349 < TODAY()))
Now, unfortunately sumproduct does not work the same way in VBA.
You have to wrap it in the Evaluate Function..

X = Evaluate("=SUMPRODUCT(--(B2:B349=""COMPLETED""),--(C2:C349 < TODAY()))")
 
Upvote 0
Thanks so much for your help, however perhaps I didn't explain myself correctly - the code you have provided does work but results in cell value = FALSE. What I am looking for is for cell value to be = number of rows which match the two critiera.

Below is the code I'm using so far could you please take a look?

Thanks

Code:
'Populate Row F with totals data
    Dim LRTotal As Long
    With ActiveSheet
 
 
    LRTotal = .Range("B" & .Rows.Count).End(xlUp).Row
    .Range("H1").Formula = "=NOW()"
    .Range("F2").Formula = "=COUNTIF(B2:B" & LRTotal & ",""*"")"
    .Range("F3").Formula = "=COUNTIF(B2:B" & LRTotal & ",""COMPLETED"")"
    .Range("F4").Formula = "=COUNTIF(B2:B" & LRTotal & ",""ABANDONED"")"
    .Range("F5").Formula = X = Evaluate("=SUMPRODUCT(--(B2:B" & LRTotal & =""COMPLETED""),--(C2:C" & LRTotal & "< TODAY()))")
    End With
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,550
Members
452,927
Latest member
rows and columns

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