Link to home
Start Free TrialLog in
Avatar of prodempsey
prodempseyFlag for United States of America

asked on

Excel VBA - How do I add another condition to SUMIFS formula using a variable

I want to use this formula in a VBA sub, but I'm using variables for the last two conditions?

=SUMIFS(PAD[VALUE],PAD[MNS],"<" & MNSInput,PAD[SOURCE],SourceInput1,PAD[A.B.C.D.],"<>?Y*",PAD[A.B.C.D.],"<>?B*")

I have something similar working using a variable on the last condition, but as stated above I want to add another condition using a different variable:

Range("K18").Formula = "=SUMIFS(PAD[VALUE],PAD[MNS],""<"" & MNSInput,PAD[SOURCE],SourceInput1,PAD[A.B.C.D.],""<>" & strNonRfndSum1 & """)"

I can't seem to get my syntax right.
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prodempsey

ASKER

Thanks Rgonzo, that works!  You make it look easy.
Thanks Rgonzo!