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

Data Analysis

  • Understanding Pivot Tables in Excel
  • Excel Pie Chart
  • Excel Bar Chart
  • Conditional Formatting Icon Sets Examples in Excel
  • Chart Axes in Excel

References

  • How to use Excel INDIRECT Function
  • How to create dynamic named range with OFFSET in Excel
  • Get nth match with INDEX / MATCH in Excel
  • Left Lookup in Excel
  • Approximate match with multiple criteria in Excel

Data Validations

  • Excel Data validation specific characters only
  • Excel Data validation no punctuation
  • Excel Data validation don’t exceed total
  • Excel Data validation date in next 30 days
  • Excel Data validation with conditional list

Subtotal by invoice number in Excel

by

This tutorial shows how to Subtotal by invoice number in Excel using the example below;

Formula

=IF(COUNTIF(range,criteria)=1,SUMIF(range,criteria,sumrange,"")

Explanation

To subtotal values by invoice number, you can use a formula based on COUNTIF and SUMIF. In the example shown, the formula in E5 is:

=IF(COUNTIF($B$5:B5,B5)=1,SUMIF($B:$B,B5,$D:$D),"")

How this formula works

This formula uses COUNTIF with an expanding range to first check if the current row is the first occurrence of a given invoice number:

COUNTIF($B$5:B5,B5)=1

This expression only returns TRUE when this is the first occurrence of a given invoice number. If so, a SUMIF calculation is run:

SUMIF($B:$B,B5,$D:$D)

Here, SUMIF is used used to generate a total sum by invoice number, using the amounts in column D.

Worked Example:   Sum if not blank in Excel

If the the count is not 1, the formula simply returns an empty string (“”)

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

  • AND function: Description, Usage, Syntax, Examples and Explanation
  • OR function: Description, Usage, Syntax, Examples and Explanation
  • SWITCH function example in Excel
  • Complete List of Excel Logical Functions, References and Examples
  • How to use Excel NOT Function

Date Time

  • How to get Holiday Date from Year in Excel
  • Calculate number of hours between two times in Excel
  • Add workdays no weekends in Excel
  • Convert date to month and year in Excel
  • Extract date from a date and time in Excel

Grouping

  • How to randomly assign data to groups in Excel
  • How to randomly assign people to groups in Excel
  • If cell contains one of many things in Excel
  • Categorize text with keywords in Excel
  • Group numbers at uneven intervals in Excel

General

  • Basic text sort formula in Excel
  • 44 Practical Excel IF function Examples
  • How to make excel worksheets print on one page?
  • How to get random value from list or table in Excel
  • How to Delete Cells, Row and Rows in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning