• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • SALE 20% Off All Courses
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Logout
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Excel Shortcut When Using Dates as Formula Criteria

You are here: Home / Excel Formulas / Excel Shortcut When Using Dates as Formula Criteria
Excel Shortcut When Using Dates as Formula Criteria
February 13, 2013 by Mynda Treacy

Working with Dates in Excel can be frustrating because a date criteria in one formula doesn’t always work in another.

Using the data below let’s say we want to summarise units sold by Product for January.

Excel SUM using Date as criteria

Note: the data above is formatted as a Table which means we can use Structured References in our formulas instead of cell ranges. Click here to read how Structured References work.

Below are 5 different formulas that all summarise the data in our table based on the criteria in column B and the date in Column A.

Excel SUM using Date as criteria

Notice the different ways the Date criteria is entered in each formula?

Let’s look at the pros and cons for each one.

1. SUMIFS Formula with Fixed Dates

=SUMIFS(Table1[Units],Table1[Product],E2,Table1[Date], ">=1/01/2013",Table1[Date],"<=31/01/2013")

Pros:

  • SUMIFS is an easy formula to use.

Cons:

  • Dates are hard keyed which means the formula isn’t dynamic. Formula # 2 is better.
  • If you only have Excel 2003 then you don’t have the SUMIFS Function. Use options 3, 4 or 5 instead.

2. SUMIFS Formula with Dynamic Date Reference

=SUMIFS(Table1[Units],Table1[Product],E3,Table1[Date],">="&$F$1,Table1[Date],"<="&EOMONTH($F$1,0))

Pros:

  • Same as formula # 1 plus the date criteria is linked to a cell which means if the cell changes you don’t need to change the formula, and if you want to summarise February, March.... you can simply insert columns beside F and copy the formula across without having to update it.

Cons:

  • SUMIFS isn’t available in Excel 2003.

3. SUMPRODUCT Formula with Fixed Dates

=SUMPRODUCT(Table1[Units]*(Table1[Product]=E4)*(Table1[Date] >=DATEVALUE("1/1/2013"))* (Table1[Date]<=DATEVALUE("31/1/2013")))

Pros:

  • SUMPRODUCT works in Excel 2003 onwards

Cons:

  • Hard keyed date means it’s not dynamic.
  • Need to use the DATEVALUE function for Excel to interpret the date criteria correctly.

4. SUM array formula

{=SUM(Table1[Units]*(Table1[Product]=E5)*(TEXT(Table1[Date],"mmm-yy")=$F$1))}

Pros:

  • This array formula works in Excel 2003 onwards
  • Dynamic date reference to cell F1
  • Only one date criteria is required. Using TEXT(Table1[Date],"mmm-yy") tells Excel to find all dates for the month of Jan-13 so we don’t need to specify ">=1/01/2013" and "<=31/01/2013".

Cons:

  • It’s an array formula which means it’s not the most efficient formula, plus some people don’t understand how array formulas work so it is susceptible to human error.
  • We need to enter the date in cell F1 as text. See how the date in the formula bar below is preceded by an apostrophe, yet in the cell you can’t see it. This apostrophe forces Excel to interpret the value as text.

Excel SUM using Date as criteria

What is interesting is this format works in all of the above formulas, but if you were to enter the date like this: 1/01/2013 and format it as mmm-yy using cell formats, then formulas 4 and 5 don’t work – see below:

Excel SUM using Date as criteria

5. SUMPRODUCT Formula

=SUMPRODUCT(Table1[Units],(Table1[Product]=E6)*(TEXT(Table1[Date],"mmm-yy")=$F$1))

Pros:

  • Works in Excel 2003 onwards.
  • Dynamic date reference to cell F1.
  • Only one date criteria is required like the SUM array formula above.
  • It’s not an array formula.

Cons:

  • Requires the date in cell F1 to be entered as text.

The downside with formatting the date criteria as text is you can’t use AutoFill because Excel doesn’t recognise the series.

However if it’s something you’re going to use regularly you can set up a custom AutoFill list.

Excel 2007 > Windows button > Excel Options > Popular > ‘Edit Custom Lists’ > Add a new list

Excel 2010 > File tab > Options > Advanced > General > ‘Edit Custom Lists’ > Add a new list.

Excel SUM using Date as criteria

Now when you type in the first two months from your series you can use the AutoFill button to drag and fill the remaining dates.

Excel SUM using Date as criteria

Excel SUM using Date as criteria

A special thanks to Martin Cronin for sharing his TEXT(Table1[Date],"mmm-yy")=$F$1) trick with me.

If you liked Martin's tip please show your appreciation by sharing it using the social media links below.

Excel Shortcut When Using Dates as Formula Criteria

More Excel Dates Posts

SUMIFS Formula Referencing Cells Containing Dates

SUMIFS Formula Referencing Cells Containing Dates

More Sumif Posts

More Sumifs Posts

More Sumproduct Posts

More Excel Formulas Posts

top excel functions for data analysts

Top Excel Functions for Data Analysts

Must know Excel Functions for Data Analysts and what functions you don’t have to waste time learning and why.
excel advanced formula environment

Excel Advanced Formula Environment

Excel Advanced Formula Environment is a long awaited, new improved way to write, name and store Excel formulas.
Pro Excel Formula Writing Tips

Pro Excel Formula Writing Tips

Must know Excel formula writing tips, tricks and tools to make you an Excel formula ninja, including a new formula editor.
excel shaping arrays

New Array Shaping Excel Functions

The Excel Shaping Array Functions makes it easier than ever to reshape arrays and ranges using these purpose built functions
excel nested if functions what not to do

Excel IF Formulas and What Not To Do

Excel IF formulas can get out of hand when you nest too many IFs. Not only do they become unwieldy they’re difficult for anyone to understand
excel image function

Excel IMAGE Function

The Excel IMAGE Function enables you to embed images in a cell using a formula. It supports BMP, JPG/JPEG, GIF, TIFF, PNG, ICO, and WEBP files

Excel VSTACK and HSTACK Functions

New Excel VSTACK and HSTACK functions makes combining arrays of cells easy and with some clever tricks we can extend their capabilities.
identify overlapping dates and times in excel

Identify overlapping dates and times in Excel

How to identify overlapping dates and times in Excel with a formula that checks a range of cells. Works with Dates and Times.
New Excel Text Functions

TEXTSPLIT, TEXTBEFORE and TEXTAFTER Functions

TEXTAFTER, TEXTBEFORE and TEXTSPLIT are exciting new Excel Text functions. They’re fairly self-explanatory, however TEXTSPLIT has some cool features.

Top 10 Intermediate Excel Functions

Take your Excel skills to the next level with this top 10 intermediate Excel functions. These are must know functions for all Excel users.




Category: Excel FormulasTag: excel dates, sumif, sumifs, sumproduct
Previous Post:Excel Ignore Blanks in Data Validation ListExcel Ignore Blanks in Data Validation List
Next Post:Excel Surveys (Forms) an Easy Way to Collect DataExcel Surveys an Easy Way to Collect Data

Reader Interactions

Comments

  1. Francis Franco

    February 16, 2013 at 5:49 am

    I am having problem with this [Item] in your formula under Excel Shortcut
    when using Dates as Formula Criteria because it has show me 0
    This is your formula as follow:
    =sumifs(Table1[Units],Table1[Item???],E2,Table1[Date],”>=1/01/2013″,Table[Date],”<=31/01/2013')
    When I use [Product] instead of your what is this [Item] in my formula,this is still show nothing neither. Can you show me where this[Item] represent??

    Reply
    • Carlo Estopia

      February 16, 2013 at 2:10 pm

      Hi Francis,

      Greetings.

      Yes, It should have been a Product.
      However, We may be experiencing the same problem because the
      available date formats in my Excel doesn’t have a format date
      the same as in our example.

      So what you want to do is change [Item] to [Product],
      and Make sure your Dates in the formula and your Date Formats
      in your table are the same.

      So In my case the date format in my table is m/d/yyyy i.e. 2/1/2013.
      So Change the formula like this

      =SUMIFS(Table1[Units],Table1[Product],E2,Table1[Date],">=2/1/2013",Table1[Date],"<=2/1/2013")
      

      ALSO: Make sure you put a criteria in E2. Say "Goggles"

      Hopefully.... I'm sure you'll get results.

      Read More on : SUMIFS
      Tables

      Cheers.

      CarloE

      Reply
  2. Kris

    February 15, 2013 at 6:28 am

    Thank you Mynda for the great comparision of the techniques!

    I’d like to add one thing could be important for those who use non-english regional settings in Windows.
    Most of the above mentioned formulas will not work in non-english environment, because date format, date separator character and the string parameter of TEXT formula is different. In international environment better to avoid these kind of string constants.

    We described the problem of TEXT formula here:
    https://sites.google.com/site/e90e50fx/home/funzioni-excel-con-argomenti-costituiti-da-valori-di-testo-seconda-parte/excel-functions-with-text-value-arguments-second-part

    Cheers,
    Kris

    Reply
    • Mynda Treacy

      February 15, 2013 at 9:01 am

      Hi Kris,

      Great points. Thanks for sharing 🙂

      Mynda.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Current ye@r *

Leave this field empty

Sidebar

More results...

Course Sale

mynda treacy microsoft mvpHi, I'm Mynda Treacy and I run MOTH with my husband, Phil. Through our blog, webinars, YouTube channel and courses we hope we can help you learn Excel, Power Pivot and DAX, Power Query, Power BI, and Excel Dashboards.

Subscribe to Our Newsletter

Receive weekly tutorials on Excel, Power Query, Power Pivot, Power BI and More.

We respect your email privacy

Guides and Resources

  • Excel Keyboard Shortcuts
  • Excel Functions
  • Excel Formulas
  • Excel Custom Number Formatting
  • ALT Codes
  • Pivot Tables
  • VLOOKUP
  • VBA
  • Excel Userforms
  • Free Downloads

239 Excel Keyboard Shortcuts

Download Free PDF

Free Webinars

Excel Dashboards Webinar

Watch our free webinars and learn to create Interactive Dashboard Reports in Excel or Power BI

Click Here to Watch Now

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
trustpilot excellent rating
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk – For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved

Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.