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

Data Analysis

  • How to combine 2 or more chart types in a single chart in Excel
  • How To Filter Data in Excel
  • Create Scatter Chart in Excel
  • Get column name from index in Excel Table
  • How to calculate correlation coefficient Correlation in Excel

References

  • Convert text string to valid reference in Excel using Indirect function
  • How to get address of first cell in range in Excel
  • Excel Advanced Lookup using Index and Match Functions
  • How to get last column number in range in Excel
  • How to use Excel MMULT Function

Data Validations

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

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.

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

Post navigation

Previous Post:

How to use Excel CHOOSE Function

Next Post:

Customize Ribbon 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

  • Return blank if in Excel
  • How to use Excel OR Function
  • How to use Excel FALSE Function
  • AND function: Description, Usage, Syntax, Examples and Explanation
  • How to return blank in place of #DIV/0! error in Excel

Date Time

  • How to calculate nth day of year in Excel
  • Basic Overtime Calculation Formula in Excel
  • Create date range from two dates in Excel
  • Convert date string to date time in Excel
  • Sum through n months in Excel

Grouping

  • If cell contains one of many things in Excel
  • How to randomly assign data to groups in Excel
  • How to randomly assign people to groups in Excel
  • Map text to numbers in Excel
  • Group times into unequal buckets in Excel

General

  • How to calculate project complete percentage in Excel
  • Count cells that do not contain errors in Excel
  • How to get original price from percentage discount in Excel
  • Subtotal by invoice number in Excel
  • Find, Select, Replace and Go To Special in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning