Anyone have a quick fix for SUMIFonlycountonce.xlsx

Looking to count ordered units based on a number as Parent or Customer, but not to double the order if the number happens to be both Parent and Customer. Trying to get to 40 in one formula with this example so I don't have to use a helper for 200+ parents/customers.