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

Data Analysis

  • Excel Bar Chart
  • How To Filter Data in Excel
  • How to Create Thermometer Chart in Excel
  • How To Create Frequency Distribution in Excel
  • How to Use Solver Tool in Excel

References

  • Perform case-sensitive Lookup in Excel
  • How to use Excel COLUMN Function
  • Last row number in range
  • Find closest match in Excel
  • Extract all partial matches in Excel

Data Validations

  • How To Create Drop-down List in Excel
  • Excel Data validation allow weekday only
  • Excel Data validation date in next 30 days
  • Excel Data validation must begin with
  • Excel Data validation must contain specific text

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

  • IFNA function: Description, Usage, Syntax, Examples and Explanation
  • Return blank if in Excel
  • How to use Excel NOT Function
  • How to use Excel FALSE Function
  • OR function Examples in Excel

Date Time

  • Get project midpoint in Excel
  • How to enter Today’s Date or Static Date and Time in Excel
  • Convert date to text in Excel
  • Get fiscal quarter from date in Excel
  • Basic timesheet formula with breaks in Excel

Grouping

  • Group times into unequal buckets in Excel
  • Running count group by n size in Excel
  • How to randomly assign data to groups in Excel
  • Map text to numbers in Excel
  • Calculate conditional mode with criteria in Excel

General

  • How to calculate total from percentage in Excel
  • Mark Workbook as Final in Excel
  • Check if multiple cells have same value in Excel
  • AutoRecover file that was never saved in Excel
  • Advanced Number Formats in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning