0
votes

I have a spreadsheet in excel where in the leftmost column I have order numbers and the corresponding cell to each cell in the order number columns contain the dollar amount for that particular order. Orders from the same customer have the same order number but different dollar amounts and listed separately in the spreadsheet. Is there a way to systematically condense these orders into a single order for each customer with a corresponding dollar amount equal to the sum of all the orders?

order number    Dollar Amount           order number    dollar amount
1234                $100                     1234         $1,000 
1234                $200                     2345         $1,100 
1234                $300                
1234                $400                
2345                $500                
2345                $600                
3
just added an example @janaspagekillianjackson

3 Answers

1
votes

There is an easy way without any functions or script to do this, but doesn't look exactly like what you want.

Please see steps below:

  1. Sort the data in order number
  2. Select the the columns order number and Dollar Amount
  3. Go to Data -> Subtotal
  4. Select the following settings:

Subtotal Settings

You should now have all the information you are asking for just not in a separate column. It should look like this.

order number    Dollar Amount
1234    $100 
1234    $200 
1234    $300 
1234    $400 
1234 Total  $1,000 
2345    $500 
2345    $600 
2345 Total  $1,100 
Grand Total $2,100 
1
votes

I would go for the other solutions (acher's & pnuts') but if you absolutely have to use formulas, this might help:

enter image description here

Result:

enter image description here

Formulas:

Column C (Array formula, confirm with Ctrl+Shift+Enter):

=INDEX($A$2:$A$20,MATCH(0,COUNTIF($C$1:C1,$A$2:$A$20),0))

Column D

=SUMIF($A$2:$A$7,C2,$B$2:$B$7)

Useful link for the formula on column C.

I hope that helps!

0
votes

Create a unique list of order numbers (eg with DATA > Sort & Filter - Advanced, Copy to another location List range: $A:$A, Copy to: E1, tick Unique records only) then in say F2 and copied down:

 =SUMIF(A:A,E2,B:B)