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

Data Analysis

  • How to calculate correlation coefficient Correlation in Excel
  • Example of COUNTIFS with variable table column in Excel
  • How to do a t-Test in Excel?
  • How to create Checklist in Excel
  • What-If Analysis: Scenarios and Goal Seek in Excel

References

  • How to reference named range different sheet in Excel
  • How to use Excel INDIRECT Function
  • How to use Excel COLUMN Function
  • Merge tables with VLOOKUP in Excel
  • Count rows that contain specific values in Excel

Data Validations

  • Excel Data validation only dates between
  • Excel Data validation allow weekday only
  • Excel Data validation exists in list
  • Excel Data validation date in specific year
  • 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

  • Not Equal To ‘<>‘ operator in Excel
  • How to use Excel TRUE Function
  • AND function: Description, Usage, Syntax, Examples and Explanation
  • IF with wildcards in Excel
  • IF with boolean logic in Excel

Date Time

  • Display Days until expiration date in Excel
  • WORKDAY function: Description, Usage, Syntax, Examples and Explanation
  • How to Calculate Age in Excel
  • Get month name from date in Excel
  • Get month from date in Excel

Grouping

  • Group times into 3 hour buckets in Excel
  • Group times into unequal buckets in Excel
  • How to randomly assign people to groups in Excel
  • Group arbitrary text values in Excel
  • Categorize text with keywords in Excel

General

  • Find Most Frequently Occurring Word in Excel Worksheet
  • Creating and Opening an existing file in Excel
  • Select, Insert, Rename, Move, Delete Worksheets in Excel
  • How to generate random number between two numbers in Excel
  • Print Excel Sheet In Landscape Or Portrait
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning