Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.
Public Sub CalculateYTDCustomerSalesAndMargins() Dim UniqueCustomers, Output, Claimbacks As Variant Dim i, c, j, k, z As Double UniqueCustomers = Range("UniqueCustomers") Claimbacks = Range("ClaimBacks") ReDim Output(1 To UBound(UniqueCustomers), 1 To 5) j = 0 'Sales variable k = 0 'Cost of sales variable z = 0 'Claim backs variable For c = 1 To UBound(UniqueCustomers) For i = 1 To UBound(Claimbacks) If UniqueCustomers(c, 2) = Claimbacks(i, 5) Then j = j + Claimbacks(i, 11) * Claimbacks(i, 10) k = k + Claimbacks(i, 12) * Claimbacks(i, 10) z = z + Claimbacks(i, 22) Output(c, 1) = j Output(c, 2) = k Output(c, 3) = 1 - k / j Output(c, 4) = z Output(c, 5) = 1 - (k - z) / j End If Next i j = 0 'Sales variable k = 0 'Cost of sales variable z = 0 'Claim backs variable Next c Range("E2", Range("I" & UBound(UniqueCustomers) + 1)) = Output End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Office applications crashing||7||35|
|Save PowerPoint from Active Workbook Excel VBA||5||41|
|unable to isntall .net framework 3.5||19||40|
|replace blank cells with 0 starting with a specific column until no more data Excel VBA||2||10|
Join the community of 500,000 technology professionals and ask your questions.