Calculating the Sum of Prices Based on Weekdays in Excel

Calculating the Sum of Prices Based on Weekdays in Excel. In this tutorial, we’ll explore how to calculate the sum of prices based on weekdays in Excel. Sometimes, in datasets filled with price data, we need to find the total of prices based on specific conditions, such as weekdays. We can achieve this using the SUMPRODUCT and WEEKDAY functions. Let’s break down the process step by step:

Calculating the Sum of Prices Based on Weekdays in Excel

Problem Statement: We want to find the sum of price values for each day of the week, using given weekday numbers.

Formulas and Functions Used:

  • SUMPRODUCT: Multiplies corresponding components in the given arrays and returns the sum of those products.
  • WEEKDAY: Returns the day of the week as a number (1 for Sunday, 2 for Monday, and so on).

Syntax:

=SUMPRODUCT((WEEKDAY(dates) = weekday_num) * price)

Explanation:

  1. WEEKDAY(dates): This function checks the weekdays for the dates provided in the ‘dates’ range.
  2. (WEEKDAY(dates) = weekday_num): Evaluates to TRUE for the specified weekday (weekday_num) and FALSE for other weekdays.
  3. ((WEEKDAY(dates) = weekday_num) * price): Multiplies the TRUE and FALSE values by corresponding price values, turning TRUE to 1 and FALSE to 0.
  4. SUMPRODUCT: Adds up the resulting array, giving us the total price for the selected weekdays.

Example: Let’s consider a dataset where prices of products are recorded on various dates. We want to find the total price for each of the 7 weekdays. By using the above formula and providing the weekday numbers, we can achieve this calculation effortlessly.

Use of NOT Function: To find the sum of values excluding a specific weekday, we can use the NOT function in combination with WEEKDAY. The NOT function flips the TRUE and FALSE values, allowing us to exclude the specified weekday from our calculation.

Formula:

=SUMPRODUCT(NOT((WEEKDAY(dates) = G2)) * price)

Note:

  • SUMPRODUCT treats non-numeric values as 0.
  • TRUE is considered as 1, and FALSE is considered as 0 in SUMPRODUCT calculations.
  • Ensure the arrays provided in SUMPRODUCT are of the same length to avoid errors.

We hope this tutorial clarifies how to sum price values based on weekdays in Excel. For more articles on summing functions and other Excel techniques, explore our comprehensive collection of tutorials. Happy Excel computing!

We will be happy to hear your thoughts

Leave a reply

Gotkey.net
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart