Log in

View Full Version : Enter SUM SUMIFS Formula Using VBA



Rick
02-23-2013, 02:46 AM
Hello,

The function below works perfectly in a spreadsheet; however I would like to enter it as VBA code. As you can see, there are two columns with multiple conditions and one column with a single condition. Thanks in advance. - Rick



=SUM(SUMIFS($ER$11:$ER$100000,$C$11:$C$100000,{"00002","00942","00102","00302"},$J$11:$J$100000,{"A"},$K$11:$K$100000,{"S";"N";"M";"P";"X"}))

Excel Fox
02-23-2013, 04:11 PM
is this what you need?


SomeRange.Formula = "=SUM(SUMIFS($ER$11:$ER$100000,$C$11:$C$100000,{""00 002"",""00942"",""00102"",""00302""},$J$11:$J$100000,{""A""},$K$11:$K$100000,{""S"";""N"";""M"";""P"";""X""}))"

Rick
02-23-2013, 07:32 PM
Yes, thank you.

The double quotes threw me off. It works fine in VBA.