Calculate total per order; no unique information

weerder

New Member
Joined
May 22, 2020
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
Spreadsheet details the order lines by customer and by order date. There is no unique information, such as an order or invoice number, at this point. Order 1 will be to Customer A on X date and will have a number of product lines. This is followed by Order 2 to Customer B on, possibly, the same date as for the previous customer, and will have a number of products. I need a total for EACH of these orders.
Thanks for any help
 

Attachments

  • Calculate total per order; no unique information.png
    Calculate total per order; no unique information.png
    84 KB · Views: 6
  • Calculate total per order; no unique information.png
    Calculate total per order; no unique information.png
    84 KB · Views: 6

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
How about
Excel Formula:
=IF(COUNTIFS(A$2:A2,A2,B$2:B2,B2)=COUNTIFS(A:A,A2,B:B,B2),SUMIFS(D:D,A:A,A2,B:B,B2),"")
 
Upvote 0
Solution
Hi
VBA
VBA Code:
Sub test()
    Dim a
    Dim i&
    a = Cells(1, 1).CurrentRegion
    ReDim Preserve a(1 To UBound(a), 1 To UBound(a, 2) + 1)
    With CreateObject("scripting.dictionary")
        For i = 2 To UBound(a)
            If Not .exists(a(i, 1)) Then
                .Add a(i, 1), a(i, 4)
                a(i, UBound(a, 2)) = .Item(a(i, 1))
            Else
                .Item(a(i, 1)) = .Item(a(i, 1)) + a(i, 4)
                a(i - 1, UBound(a, 2)) = "":  a(i, UBound(a, 2)) = .Item(a(i, 1))
            End If
        Next
    End With
    Cells(2, 5).Resize(UBound(a) - 1) = Application.Index(a, Evaluate("row(2:" & UBound(a) & ")"), 5)
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top