• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sum (Sumif in VBA

Hi , i receiving an error 1004 while trying to execute the below code .

Sheets("result").Range("AC10").Formula = "=SUM(SUMIF(Data!A16:A" & DATAlROW & " ,{" Awards & Incentives","Rebate & Givebacks","Unbilled Adjustments","Fixed Fee Billing"}"", Data!G16:G" & DATAlROW & ")"


Appreciate your quick help .
 
Try the following line
Code:
Range("A10").FormulaR1C1 = "=SUM(SUMIF(Data!A16:A" & CStr(DATAlROW) & ",{" & Chr(34) & "Awards & Incentives" & Chr(34) & "," & Chr(34) & "Rebate & Givebacks" & Chr(34) & "," & Chr(34) & "Unbilled Adjustments" & Chr(34) & "," & Chr(34) & "Fixed Fee Billing" & Chr(34) & "}, Data!G16:G" & DATAlROW & "))"

without the Sheets part and modified function
 
Thanks Hui,

May i know what is the CSTR & Chr(34) means for and the job they are doing . This will help me in understanding more.
 
Cstr() converts a Number to a String
Chr(34) is the code for a " and so it can be used where you want to include a " character within a string rather than defining the start/end of a string
I find it easier to use than """
 
Back
Top