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 lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
3,455
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?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,532
Messages
5,854,288
Members
431,636
Latest member
shabbas313

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