I have multiple worksheetfunction.sumifs in vba and they are calculating correctly, however when I try and stand the
worksheetfunction.sumifs val = Application.SumIf(Range("D1:D20"), "" * "&temp&" * "", Range("C1:C20")) & " , -" & Application.SumIf(Range("E1:E20"), "" * "&temp&" * "", Range("H1:H20")) & " , +" & Application.SumIf(Range("F1:F20"), "" * "&temp&" * "", Range("I1:I20")) & " , -" & Application.SumIf(Range("G1:G20"), "" * "&temp&" * "", Range("J1:J20"))
the variable is returned as a string, with the calculation, something like "80-100-0-0-0-0". I would like the worksheetfunction.sumif to actually sum the product of the sumifs. I have tried putting worksheetfunction.sum around the sumifs but to no avail. Any ideas? The reason I am doing this is to not have formulas in a different cell to speed up the very large Excel I am working with. I have also tried doing the sumifs with the ", -" but no joy either.



& " , -" &and ` " , +" &` which is forcing it into a string put-and+respectively, without any wrapper function.tempa variable or are you looking for anything that contains the word "temp"?Val = Application.SumIf(Range("D1:D20"), "* temp *", Range("C1:C20")) - Application.SumIf(Range("E1:E20"), "* temp *", Range("H1:H20")) + Application.SumIf(Range("F1:F20"), "* temp *", Range("I1:I20")) - Application.SumIf(Range("G1:G20"), "* temp *", Range("J1:J20"))