If you have a list on your Excel worksheet, and a date in each row, you can use a formula to count items in a date range. For example, how many Pencil shipments went out in September, based on the Ship Date column?
Use COUNTIFS and Cell References
The easiest way to find the number of shipments is to use the COUNTIFS function (Excel 2007 and later) and enter the product name, and the start and end dates on the worksheet.
In this example, there is a drop down list of products in cell A2. The Start date is entered in cell D1, and the End date in cell D2.
To calculate the number of Pen shipments in the date range, enter this formula in cell F2:
- The first argument, B5:B18, is the first range to check for criteria.
- The 2nd argument, A2, is the range with the value for criteria 1 (Product)
- The 3rd argument, F5:F18, is the range to check for criteria 2.
- The 4th argument, “>=”&D1, is the cell with the value for criteria 2 (the Start date), and the operator to use with that value (greater than or equal to)
- The 5th argument, F5:F18, is the range to check for criteria 3.
- The 6th argument, “<=”&D2, is the range with the value for criteria 3 (the End date), and the operator to use with that value (less than or equal to)
The result will show a count of the number of times that all the criteria are met.
To get the total units for a different date range, change the product name or start and end dates in the heading section. In the next screen shot, the result shows that there was 1 Binder shipment between August 15th and September 15th.