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?
To deal with this job, you can apply the below formulas:
Please copy and paste the following formula into a blank cell:
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:
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:
And then, you should press Ctrl + Shift + Enter keys together to get the correct result, see screenshot:
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.
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: