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

Data Analysis

  • How To Create Pareto Chart in Excel
  • Error Bars in Excel
  • Excel Line Chart
  • Get column index in Excel Table
  • Working With Tables in Excel

References

  • How to get relative row numbers in a range in Excel
  • How to use Excel VLOOKUP Function
  • How to use Excel MMULT Function
  • Get nth match with INDEX / MATCH in Excel
  • How to get address of named range in Excel

Data Validations

  • Excel Data validation number multiple 100
  • Excel Data validation must contain specific text
  • Excel Data validation with conditional list
  • Excel Data validation exists in list
  • Excel Data validation unique values only

Sum by weekday in Excel

by

This tutorial shows how to Sum by weekday in Excel using the example below;

Formula

=SUMPRODUCT((WEEKDAY(dates)=day_num)*values)

Explanation

To sum data by weekday (i.e. sum by Mondays, Tuesdays, Wednesdays, etc.), you can use the SUMPRODUCT function together with the WEEKDAY function.

In the example shown, the formula in H4 is:

=SUMPRODUCT((WEEKDAY(dates,2)=G4)*amts)

How this formula works

You might wonder why we aren’t using the SUMIF or SUMIFS function? These appear to be an obvious way to sum by the days of the week. However, without adding a helper column with a weekday value, there is no way to create a criteria for SUMIF that takes into account the weekday.

Worked Example:   Count numbers third digit equals 3 in Excel

Instead, we use the handy SUMPRODUCT function, which handles arrays gracefully without the need to use Control + Shift + Enter.

We are using SUMPRODUCT with just one argument, which consists of this expression:

(WEEKDAY(dates,2)=G4)*amts

Working from the inside out, the WEEKDAY function is configured with the optional argument 2, which causes it to return numbers 1-7 for the days Monday-Sunday, respectively. This is not necessary, but it makes it easier to list the days in order and pick up the numbers in column G in sequence.

Worked Example:   Roll back weekday to Friday base on a particular date in Excel

WEEKDAY evaluates each value in the named range “dates” and returns a number. The result is an array like this:

{3;5;3;1;2;2;4;2}

The numbers returned by WEEKDAY are then compared to the value in G4, which is 1.

Worked Example:   Count unique text values in a range in Excel

{3;5;3;1;2;2;4;2}=1

The result is an array of TRUE/FALSE values.

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

Next, this array is multiplied by the values in the named range “amts”.  SUMPRODUCT only works with numbers (not text or booleans) but math operations automatically coerce the TRUE/FALSE values to one’s and zeros, so we have:

{0;0;0;1;0;0;0;0}*{100;250;75;275;250;100;300;125}

Which yields:

{0;0;0;275;0;0;0;0}

With just this single array to process, SUMPRODUCT sums the items and returns the result.

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

  • IF with wildcards in Excel
  • IF function: Description, Usage, Syntax, Examples and Explanation
  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • Invoice status with nested if in Excel
  • How to use IFS function in Excel

Date Time

  • How to determine year is a leap year in Excel
  • SECOND function: Description, Usage, Syntax, Examples and Explanation
  • Display the current date and time in Excel
  • How to calculate Quarter of Date in Excel
  • Get age from birthday in Excel

Grouping

  • Group numbers with VLOOKUP in Excel
  • Group times into 3 hour buckets in Excel
  • Group arbitrary text values in Excel
  • If cell contains one of many things in Excel
  • How to randomly assign data to groups in Excel

General

  • Hide and Unhide Columns or Rows in Excel
  • Delete Blank Rows at Once in Excel
  • Count cells that do not contain errors in Excel
  • How to get random value from list or table in Excel
  • How to generate random times at specific intervals in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning