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

Data Analysis

  • How To Compare Two Lists in Excel
  • Excel Line Chart
  • How to calculate average last N values in a table in Excel
  • How to Create Thermometer Chart in Excel
  • Get column index in Excel Table

References

  • How to get last row in numeric data in Excel
  • How to use Excel LOOKUP Function
  • Two-way lookup with VLOOKUP in Excel
  • How to get address of last cell in range in Excel
  • How to use Excel VLOOKUP Function

Data Validations

  • Excel Data validation unique values only
  • Prevent invalid data entering in specific cells
  • Excel Data validation specific characters only
  • Excel Data validation allow weekday only
  • Excel Data validation no punctuation

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

  • Check multiple cells are equal in Excel
  • How to use Excel NOT Function
  • OR function Examples in Excel
  • SWITCH function example in Excel
  • Extract multiple matches into separate rows in Excel

Date Time

  • How to determine year is a leap year in Excel
  • How to join date and text together in Excel
  • Get days, hours, and minutes between dates in Excel
  • How to calculate nth day of year in Excel
  • How to get same date next month or previous month in Excel

Grouping

  • Group numbers at uneven intervals in Excel
  • How to randomly assign people to groups in Excel
  • Group numbers with VLOOKUP in Excel
  • Group times into unequal buckets in Excel
  • Group arbitrary text values in Excel

General

  • List sheet names with formula in Excel
  • How to calculate total from percentage in Excel
  • Spell Check in Excel
  • 3D SUMIF for multiple worksheets in Excel
  • 231 Keyboard Shortcut Keys In Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning