DSUM() with multi-criteria in single field

pholness

Board Regular
Joined
Jan 18, 2013
Messages
50
Hi! I have the following DSUM() code with multi-criteria, BUT I need to adjust it so that I can 1) filter for more than one criteria on [Shift Info] and 2) so that the criteria for [FR_Date] range works?

For Example: And [Shift Info] = 'Day' And [Shift Info] = 'Night' And [Shift Info] = 'Onboarding-Training'

Code:
DSum("[Duration]", "MainEventForceReports", "[Duration] <> 0 And [FR_Date] > #" & Me.Text1.Value & "# And [FR_Date] < #" & Me.Text2.Value & "# And [Workfront] = 'Planning 2016 Spring' And [Shift Info] = 'Day'")

Thanks in advance!
 

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
Your date range is "not working"? I don't see what's wrong with it if not. How about
DSum("[Duration]", "MainEventForceReports", "[Duration] <> 0 And [FR_Date] BETWEEN #" & Me.Text1 & "# And #" & Me.Text2 & "# And [Workfront] = 'Planning 2016 Spring' AND [Shift Info] IN('Day','Night','Onboarding-Training'))

If this is on a report, I'd let the report group footer or report footer handle the sum. You can also set a textbox source to the value returned by a totals query if it's on a form/report.
P.S. - you don't need .value - it is the default property for the control. Also, -'s in names is not good form.
 
Last edited:
Upvote 0
One more thing re: 'Not IN'

This seems to shoot an error: ...
Code:
[Workfront] = NOT IN('Planning 2016 Fall','Planning 2017 Spring') AND
...

Would you know why?
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,004
Members
452,374
Latest member
keccles

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