Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How To Create Frequency Distribution in Excel
  • Example of COUNTIFS with variable table column in Excel
  • What-If Analysis: Scenarios and Goal Seek in Excel
  • How to count table columns in Excel
  • How to create Gauge Chart in Excel

References

  • Two-column Lookup in Excel
  • How to use Excel COLUMN Function
  • How to get relative column numbers in a range in Excel
  • How to retrieve first match between two ranges in Excel
  • Perform case-sensitive Lookup in Excel

Data Validations

  • Excel Data validation specific characters only
  • Excel Data validation exists in list
  • Excel Data validation allow uppercase only
  • Excel Data validation whole percentage only
  • How To Create Drop-down List in Excel

Count dates in given year in Excel

by

This tutorial shows how to Count dates in given year in Excel using the example below;

Formula

=SUMPRODUCT(--(YEAR(dates)=year))

Explanation

To count dates in a given year, you can use the SUMPRODUCT and YEAR functions. In the example shown, the formula in E5 is:

=SUMPRODUCT(--(YEAR(dates)=D5))

where “dates” the a named range B5:B15.

Worked Example:   Sum columns based on adjacent criteria in Excel

How this formula works

The YEAR function extracts the year from a valid date. In this case, we are giving YEAR and array of dates in the named range “dates”, so we get back an array of results:

{2018;2017;2019;2019;2017;2019;2017;2019;2019;2018;2018}

Each date is compared to the year value in column D, to produce an array or TRUE FALSE values:

{FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;TRUE;FALSE;FALSE;FALSE;FALSE}

For the formula in E5, TRUE values are cases where dates are in the year 2017, and FALSE values represent dates in any other year.

Worked Example:   Sum 2d range with multiple criteria in Excel

Next, we use a double negative to coerce the TRUE FALSE values to 1’s and 0’s. Inside SUMPRODUCT, we now have:

=SUMPRODUCT({0;1;0;0;1;0;1;0;0;0;0})

Finally, with only one array to work with, SUMPRODUCT sums the items in the array and returns a result, 3.

Post navigation

Previous Post:

44 Practical Excel IF function Examples

Next Post:

Large with criteria in Excel

Leave a Reply Cancel reply

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

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • SWITCH function example in Excel
  • Not Equal To ‘<>‘ operator in Excel
  • OR function: Description, Usage, Syntax, Examples and Explanation
  • Return blank if in Excel
  • How to use IFS function in Excel

Date Time

  • Calculate days remaining in Excel
  • DATEVALUE function: Description, Usage, Syntax, Examples and Explanation
  • Convert time to time zone in Excel
  • How to calculate next day of week in Excel
  • Count holidays between two dates in Excel

Grouping

  • Running count group by n size in Excel
  • Map inputs to arbitrary values in Excel
  • How to randomly assign data to groups in Excel
  • Map text to numbers in Excel
  • Group times into unequal buckets in Excel

General

  • Subtotal invoices by age in Excel
  • How to fill cell ranges with random text values in Excel
  • Count cells that do not contain errors in Excel
  • Creating and Opening an existing file in Excel
  • How to set or clear a print area in Excel Worksheet
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning