sumif between two dates in VBA?

unigee

New Member
Joined
Jan 24, 2011
Messages
24
Hi Forum,

I have a SUMIF that I need to convert into VBA

Code:
MsgBox Application.WorksheetFunction.SumIfs(ws_dispatch.range("D:D"), _
                                                        ws_dispatch.range("C:C"), partnumber, _
                                                        ws_dispatch.range("E:E"), CDate("30/06/2011"))

This gives me the correct result, which tells me how many parts were dispatched on 30/06/2011

However, I need to know how many parts were dispatched from a specific date

The excel formulas equivelent is
=SUMIFS(D:D,C:C,partnumber,E:E, ">29/06/2011")
but as I need this in VBA

My attempt is this, but this returns 0
Code:
            MsgBox Application.WorksheetFunction.SumIfs(ws_dispatch.range("D:D"), _
                                                        ws_dispatch.range("C:C"), partnumber, _
                                                        ws_dispatch.range("E:E"), ">" & CDate("29/06/2011"))


And ideas?

Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Should that be:-
Code:
">" & DateValue(#30/06/2011#)
A shot in the dark...
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

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