Your example does not show the"Payments Received" data which is to matched against "Sales": I assume it is based on Customer Name AND Invoice number (and Date?).