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

Data Analysis

  • Understanding Anova in Excel
  • How To Insert and Customize Sparklines in Excel
  • Conflicting Multiple Conditional Formatting Rules in Excel
  • Conditional Formatting Data bars Examples in Excel
  • Add Outline to Data in Excel

References

  • How to get address of last cell in range in Excel
  • How to use Excel MATCH Function
  • LOOKUP function: Description, Usage, Syntax, Examples and Explanation
  • How to get relative row numbers in a range in Excel
  • Find Closest Match in Excel Using INDEX, MATCH, ABS and MIN functions

Data Validations

  • Excel Data validation allow weekday only
  • Excel Data validation must not contain
  • Prevent invalid data entering in specific cells
  • Excel Data validation date in specific year
  • Excel Data validation unique values only

Sum lookup values using SUMIF in Excel

by
This tutorial shows how to Sum lookup values using SUMIF in Excel using the example below;

Formula

=SUMPRODUCT(SUMIF(codes,lookups,values))

Explanation

To sum values retrieved by a lookup operation, you can use SUMPRODUCT with the SUMIF function.

In the example shown, the formula in H5 is:

=SUMPRODUCT(SUMIF(codes,C5:G5,values))

Where codes is the named range J4:J5 and values is the named range K4:K5.

Context

Sometimes you may want to sum multiple values retrieved by a lookup operation. In this example, we want to sum holiday time taken each week based on a code system, where F = a full day, and H = a half day. If a day is blank, no time was taken.

Worked Example:   Highlight duplicate rows in Excel

The challenge is to find a formula that both looks up and sums the values associated with F and H.

How this formula works

The core of this formula is SUMIF, which is used to lookup the correct values for F and H. Using SUMIF to lookup values is a more advanced technique that works well when the values are numeric, and there are no duplicates in the “lookup table”.

Worked Example:   Count day of week between dates in Excel

The trick in this case is that the criteria for SUMIF is not a single value, but rather an array of values in the range C5:G5:

=SUMPRODUCT(SUMIF(codes,C5:G5,values))

Because we are giving SUMIF more than one criteria, SUMIF will return more than one result. In the example shown, the result of SUMIF is the following array:

Worked Example:   Sum columns based on adjacent criteria in Excel

{1,0.5,0,0,0}

Note that we correctly get 1 for each “F” and 0.5 for each “H”., and blank values in the week generate zero.

Finally, we use SUMPRODUCT to add up the values in the array returned by SUMIF. Because there is only a single array, SUMPRODUCT simply returns the sum of all values.

Post navigation

Previous Post:

Weighted average in Excel

Next Post:

Win loss points calculation 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

  • Extract multiple matches into separate rows in Excel
  • How to use Excel TRUE Function
  • How to use Excel OR Function
  • IF with wildcards in Excel
  • IFNA function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Sum through n months in Excel
  • Add decimal hours to time in Excel
  • Convert decimal seconds to Excel time
  • WEEKDAY function: Description, Usage, Syntax, Examples and Explanation
  • Dynamic date list in Excel

Grouping

  • Group arbitrary text values in Excel
  • How to randomly assign data to groups in Excel
  • Map inputs to arbitrary values in Excel
  • How to randomly assign people to groups in Excel
  • Map text to numbers in Excel

General

  • How to Create Calendar in Excel
  • AutoRecover file that was never saved in Excel
  • 231 Keyboard Shortcut Keys In Excel
  • How to generate random number between two numbers in Excel
  • Basic numeric sort formula in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning