• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About
Home / Formulas / Advanced SUM Function Examples – The Power of SUM

Advanced SUM Function Examples – The Power of SUM

This tutorial shows some advanced SUM function examples. The SUM function is far more powerful than many people realise, and this tutorial will demonstrate its power.

We will see five examples of the SUM function being a BOSS and handling tasks that we often rely on functions such as SUMIFS, XLOOKUP, SUMPRODUCT etc to accomplish.

However, trusty old SUM can take care of them alone.

Download the Excel workbook to follow along.

Sum Multiple Criteria with OR Logic

In this first example, we need to sum the values dependent upon two criteria from the same column. For this, we need to use OR logic with the two criteria.

We have a table named tblSales and need to return the sum of the Total column for sales of the products “Burger” and “Pizza”, entered into cells E3 and F3 respectively.

The following SUM formula entered into cell G3 accomplishes this easily.

=SUM(tblSales[Total]*(tblSales[Product]=E3:F3))
Sum values with multiple criteria in the same column

It takes full advantage of the array engine built into modern Excel versions, and multiplies the array of total values by the array of TRUE or FALSE responses from the condition. Watch the video for a more detailed breakdown of this behaviour.

If you are using an older version of Excel, e.g., Excel 2010, 2013, 2016 or 2019. Then instead of pressing Enter to run the formula, press Ctrl + Shift + Enter. This runs an array formula in older Excel versions.

This concise little formula is a fantastic alternative to writing two SUMIFS functions and adding them together like the following.

=SUMIFS(tblSales[Total],tblSales[Product],E3)+SUMIFS(tblSales[Total],tblSales[Product],F3) 

Or using the brilliant SUMPRODUCT function. However, It is great to see the classic SUM function handling this task on its own.

Advanced SUM Function with OR and AND Conditions

It is only a small step from the previous function to sum values that include both AND and OR logic in its multiple criteria.

With the same table (tblSales), this formula sums the values for both the “Burger” and “Pizza” sales for only the region of the “West”. The following advanced sum formula is entered into cell E6.

=SUM(tblSales2[Total]*(tblSales2[Product]=E3:F3)*(tblSales2[Region]=G3))
SUM formula with multiple criteria using both AND and OR logic

The asterisk (*) is used to create AND logic between the two sets of conditions.

Users of the SUMPRODUCT and FILTER functions of Excel will be familiar with this behaviour. Although they may not have done it with SUM before.

Two-Way Lookup with the SUM Function

The SUM function can even perform lookups. Now, it can only return numeric values, not text, because of its sum behaviour. But it is pretty awesome.

The following formula is used in cell B2 to look up the value for the product in cell A2 (Juice) and the location in cell B1 (Plymouth).

=SUM(B5:E9*(A5:A9=A2)*(B4:E4=B1))
Two-way lookup with the SUM function

This SUM formula is more concise than some of its lookup counterparts.

For example, the INDEX and double MATCH formula approach would look like this.

=INDEX(B5:E9,MATCH(A2,A5:A9,0),MATCH(B1,B4:E4,0))

Now, I consider the INDEX function to be one of the best in Excel, so this is no slight on that function, but the SUM alternative is simpler in this instance.

How about a double XLOOKUP to create a two way lookup.

=XLOOKUP(B1,B4:E4,XLOOKUP(A2,A5:A9,B5:E9))

These array formulas are great fun.

SUM IFS with Lookup

Following on from the previous example, if the product name occurred multiple times than the SUM function would perform its primary job of summing values.

So, this example is behaving like a SUMIFS function would for the conditional sum of the product, but with the column of values to sum being based on a cell value.

=SUM(F2:I16*(D2:D16=A2)*(F1:I1=B1))
Conditional SUM and lookup

Weighted Average with the SUM Function

For the final example, we will use the SUM function to help calculate a weighted average.

The following formula is entered into cell F3 to calculate the weighted average of the different assessments and their contribution to someone’s overall score.

=SUM(tblAssessments[Score]*tblAssessments[Weight]/1)

In this formula, we have divided the product of the scores and weights by 1 as the weights total 100%.

Advanced sum function example to calculate the weighted average

It is great that there are different approaches to achieving tasks in Excel. It is one of the things that makes it so much fun.

We are always learning something new and finding fresher ways to do things.

Advanced Excel Success book

Related Posts:

  • N Functions in Excel thumbnail
    N Function in Excel
  • SWITCH function feature
    Excel SWITCH Function - Nested IF Function Alternative
  • Aggregate rows in Power Query
    Aggregate Rows in Power Query
  • Return non-adjacent columns FILTER function thumbnail
    Non-Adjacent Columns with FILTER Function

Reader Interactions

Comments

  1. John Brewster says

    1 September 2021 at 7:36 am

    I have followed the instructions on the first worksheet,
    =Sum(tblSales[Total]*(tblSales[Product]=E3:F3)) but I still get the Value error.

    Reply
    • Alan Murray says

      1 September 2021 at 5:05 pm

      It may be that you are on a version prior to 365, John. You can do the same, but press Ctrl + Shift + Enter instead of Enter when running the formula.

      Reply
      • John Brewster says

        21 September 2021 at 6:57 pm

        I have done all of that, pressed Ctrl + Shift + Enter and I still get the same result, Value. I am on Windows 10, Microsoft 365.

        Reply
        • Alan Murray says

          22 September 2021 at 6:51 am

          If you are using 365 John. You do not need to press Ctrl + Shift + Enter. You can just press Enter.

          Reply
    • Cora Knutson says

      14 February 2022 at 4:23 pm

      Hi John,
      Perhaps “tblSales” is not the name of your table?

      Reply
  2. SoftBigs says

    18 August 2023 at 2:33 pm

    This blog post is a great introduction to the SUM function. I found it helpful to see examples of how to use SUM to calculate different types of sums.

    Reply
  3. baldis basics says

    16 October 2024 at 12:36 pm

    Great insights on the SUM function! I loved the examples you provided, especially the advanced techniques for using it in complex formulas. It really helped clarify how to maximize its potential in my spreadsheets. Looking forward to more tips like this!

    Reply
    • Alan Murray says

      21 December 2024 at 4:32 pm

      You’re very welcome. Thank you!

      Reply
  4. AN777 says

    24 January 2025 at 9:15 am

    Great insights on the SUM function! I especially loved the real-world examples you provided. They really helped clarify how powerful this function can be in data analysis. Looking forward to more posts like this!

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

Recent Posts

  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
  • Custom Sort in Excel
  • Case Sensitive Lookup with XLOOKUP in Excel
Advanced Excel Success book

Footer

Contact

admin@computergaga.com

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·