Sub WriteFormulas() Dim rQnty As Range, rName As Range, rDate As Range Dim vQnty As Variant, vName As Variant, vDate As Variant Dim j As Double, dValue As Double With ThisWorkbook.Worksheets(1) Set rQnty = .Range("A2:A10") Set rName = .Range("B2:B10") Set rDate = .Range("C2:C10") End With vQnty = rQnty.Value vName = rName.Value vDate = rDate.Value For j = 1 To UBound(vQnty) dValue = WorksheetFunction.SumProduct((rQnty), --(rName = vName(j, 1)), --(rDate = vDate(j, 1))) Next j 'Range("D2").FormulaR1C1 = "=SUMPRODUCT(RC[-3]:RC[-3],--(RC[-2]:RC[-2]=""John""),--(RC[-1]:RC[-1]=""Jan""))" End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
An Experts Exchange subscription includes unlimited access to online courses.Get Started
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE