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

Data Analysis

  • How To Load Analysis ToolPak in Excel
  • Add Outline to Data in Excel
  • Move chart to a separate worksheet in Excel
  • Conditional Formatting Rules in Excel
  • Understanding Pivot Tables in Excel

References

  • Multi-criteria lookup and transpose in Excel
  • To count total rows in a range in Excel
  • INDEX function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel TRANSPOSE Function
  • Left Lookup in Excel

Data Validations

  • Excel Data validation specific characters only
  • Excel Data validation exists in list
  • Excel Data validation must contain specific text
  • Excel Data validation must not contain
  • Excel Data validation date in next 30 days

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

  • IFERROR function: Description, Usage, Syntax, Examples and Explanation
  • TRUE function: Description, Usage, Syntax, Examples and Explanation
  • OR function Examples in Excel
  • OR function: Description, Usage, Syntax, Examples and Explanation
  • NOT function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • How to calculate Quarter of Date in Excel
  • Convert Excel time to decimal minutes
  • Calculate time difference in hours as decimal value in Excel
  • Convert Unix time stamp to Excel date
  • Get last weekday in month in Excel

Grouping

  • Group numbers at uneven intervals in Excel
  • Group times into unequal buckets in Excel
  • Group arbitrary text values in Excel
  • Calculate conditional mode with criteria in Excel
  • Running count group by n size in Excel

General

  • How to calculate percentage of total in Excel
  • Count cells that do not contain many strings in Excel
  • Convert column number to letter in Excel
  • Common Errors in Excel
  • Select, Insert, Rename, Move, Delete Worksheets in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning