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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
2,128
Office Version
  1. 365
Platform
  1. Windows
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:

pholness

Board Regular
Joined
Jan 18, 2013
Messages
50
Thanks! + Thanks for the info - you're correct. This solved the issue.
 

pholness

Board Regular
Joined
Jan 18, 2013
Messages
50
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,132,646
Messages
5,654,565
Members
418,140
Latest member
ahepple86

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
Top