I think that it’s easier to explain my problem with an example:

Based on the spreadsheet above, the formula =DSUM(A4:D8,B4,A1:A2) works, returning 20.
Why =DSUM(A4:D8,B4,{"OrderID";">10567"}) does not work? (It returns #VALUE!)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on what’s said about D-Functions on this page, I think you need to have the criteria in a separate cell.
EDIT: If the goal of including the criteria in the formula is to make it more readable, you could work with named ranges instead.
EDIT 2: In response to your comments.
It’s not possible to do what you want (include the criteria in the formula) because of how the
DSUM()function works. Take a look at the documentation forDSUMand compare it withVLOOKUP:Note the difference:
As
DSUMis looking for a range of cells that contain the criteria, there’s nothing you can do to avoid passing it just that – a range of cells.I think the best you can do is define your different criteria as named ranges, which will make it a lot easier to reference the different ones depending on what you want to do in the formula. Unfortunately, if the regular
SUMfunction is not fast enough for you, there’s not much else you can do – you will have to specify criteria in cells to useDSUM.