DMW logo
tel 01732 833085
tonbridge · kent · UK

Criteria for Microsoft Excel DSUM Formulae

Last updated on 2018-07-31 by David Wallis.


“We are running a database in Excel and want to use the DSUM function to calculate totals over ranges of dates on a month-by-month basis. This means we have to set up a DSUM formula for each month and this we are doing longhand at the moment. Is there a way we can set up a formula that we can copy to save us all the longhand work?”


This screen dump illustrates the data in the table (much simplified!) upon which you want your DSUM formula to work:

Excel Spreadsheet

And this one shows how you have set up the criteria in columns B and C, used by the DSUM formulae in column D:

Criteria Spreadsheet

The formula in cell D2 is this (I note that you use the range name “Datatable” applied to all the data in your main table, including the “Date” and “Value” column headings in row 1):


What you want to be able to do is copy the last month’s block of cells to create a new month (ie, copy the A5:D6 block to cell A7 to create a block for April).

This is the setting up you need to complete:

  1. In cell A2, input 1/1/2001
  2. Format cell A2 with a custom date format of mmm yyyy
  3. In cell A4, input the formula =DATE(YEAR(A2),MONTH(A2)+1,1)
  4. In cell B4, input the formula =">="&TEXT(A4,"dd/mm/yyyy")
  5. In cell C4, input the formula ="<"&TEXT(DATE(YEAR(A4),MONTH(A4)+1,1),"dd/mm/yyyy")
  6. In cell D4 is your formula copied from cell D2 =DSUM(Datatable,2,B3:C4)

Now, copying and pasting the range of cells A3:D4 to A5, A7, A9 and so on, will produce the results you require. No additional inputting is necessary.

Hiding columns B and C, and all the odd-numbered rows, results in a neat summary:

DMW Spreadsheet

Your Support for dmw TIPS

If you’re going to make use of Tips in any of your professional or commercial work, then please consider making a payment in recognition of the time spent publishing this website.

To make a contribution by PayPal in GBP (£ sterling) —

To make a contribution by PayPal in USD ($ US) —

To say how much you want to pay and to receive
a tax invoice for a GBP (£ sterling) contribution —


Thanks, in anticipation.

SSL Cerification


DMW Consultancy Ltd does not accept any liability for loss or damage to data to which any techniques, methods or code included in this website are applied. Back up your data; test thoroughly before using on live data.

“When we learn in school we have success criteria to help us.”

Children’s Quotes, Redland Primary School