Skip to main content

How to get subtotal based on invoice number in Excel?

If you have a list of invoice numbers with its corresponding amount in another column, now, you want to get the subtotal amount for each invoice number as the below screenshot shown. How could you solve this problem in Excel?

Get subtotal amount based on invoice number with formulas

Get subtotal amount based on invoice number with a powerful feature


Get subtotal amount based on invoice number with formulas

To deal with this job, you can apply the below formulas:

Please copy and paste the following formula into a blank cell:

=IF(COUNTIF($A$2:A2,A2)=1,SUMIF($A:$A,A2,$B:$B),"")

Then, drag the fill handle down to the cells that you want to use this formula, and the subtotal results have been calculated based on each invoice number, see screenshot:

Notes:

1. In the above formula: A2 is the first cell which contains the invoice number you want to use, A:A is the column contains the invoice numbers, and B:B is the column data that you want to get the subtotal.

2. If you want to output the subtotal results at the last cell of each invoice number, please apply the below array formula:

=IF(A2=A3,"",SUM(IF($A$2:$A$12=A2,$B$2:$B$12,0)))

And then, you should press Ctrl + Shift + Enter keys together to get the correct result, see screenshot:


Get subtotal amount based on invoice number with a powerful feature

If you have Kutools for Excel, with its useful Advanced Combine Rows feature, you can combine the same invoice number and get the subtotal based on each invoice number.

Tips:To apply this Advanced Combine Rows feature, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.

After installing Kutools for Excel, please do as this:

1. First, you should copy and paste your original data to a new range, and then select the new pasted data range, then, click Kutools > Merge & Split > Advanced Combine Rows, see screenshot:

2. In the Advanced Combine Rows dialog box, click Invoice # column name, and then click Primary Key option to set this column as key column, then, select the Amount column name which needed to be subtotaled, and then click Calculate > Sum, see screenshot:

3. After specify the settings, click Ok button, now, all the same invoice number has been combined and their corresponding amount values have been summed together, see screenshot:

Click to Download Kutools for Excel and free trial Now!


  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • Pivot Table Grouping by week number, day of week and more... Show Unlocked, Locked Cells by different colors; Highlight Cells That Have Formula/Name...
kte tab 201905
  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations