I'm trying to create a formala that inside VBA worksheet functions that is the same or similar to the following inside of excel.
"=sumifs(U:U,O:O,"TEXT",Q:Q,"TEXT1")+sumifs(U:U,O:O,"TEXT",Q:Q,"TEXT2")"
I currently have
myanswer = Application.WorksheetFunction.SumIfs(Range("U:U"), Range("O:O"), "TEXT", Range("Q:Q"), "TEXT1")
if I add more to it such as
Application.WorksheetFunction.SumIfs(Range("U:U"), Range("O:O"), "TEXT", Range("Q:Q"), "TEXT1")+***Application.WorksheetFunction.SumIfs(Range("U:U"), Range("O:O"), "TEXT", Range("Q:Q"), "TEXT2"***)
It gives an error (I have highlighted between *** the part of the code that stops working. I'm sure there is a simple "and" or "or" function but my brain is frazzled right now. Please let me know if you need any clarification (also if there are any typos I had to translate the code over as it's on another computer.)
This works for me. I've only posted as an answer to show the formatting, including the line break (not required but makes code easier to read)
MsgBox Application.WorksheetFunction.SumIfs(Range("U:U"), Range("O:O"), "TEXT", Range("Q:Q"), "TEXT1") _
+ Application.WorksheetFunction.SumIfs(Range("U:U"), Range("O:O"), "TEXT", Range("Q:Q"), "TEXT2")