ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sumif not equal to (https://www.excelbanter.com/excel-programming/399846-re-sumif-not-equal.html)

StephanieH

Sumif not equal to
 
I've tried both options and end up with the same thing. MyFormula = "ode"

Here's exactly how I have it written (with the option since it was the last
one tried)

MyFormula = Mid(ActiveCell.Formula, 2, Len(ActiveCell.Formula))
ActiveCell.Formula = "=IF(ISERROR(" & MyFormula & "),"",(" & MyFormula & "))"

Also if it helps here's what I'm changing from and to:
=AVERAGE(OFFSET(C15,-3,0,-12,1))
=IF(ISERROR(AVERAGE(OFFSET(C15,-3,0,-12,1))),"",(AVERAGE(OFFSET(C15,-3,0,-12,1))))






"StephanieH" wrote:

I need to sum column B if column A does not contact the words Large Balance.
I'm not sure how or where to designate the not like part.

Application.WorksheetFunction.SumIf(Columns("A") , < "Large Balance",
Columns("B"))
returns a syntax error


Dave Peterson

Sumif not equal to
 
You have to double up those double quotes in strings:

MyFormula = Mid(ActiveCell.Formula, 2, Len(ActiveCell.Formula))
ActiveCell.Formula = "=IF(ISERROR(" & MyFormula & "),"""",(" & MyFormula & "))"
or
MyFormula = Mid(ActiveCell.Formula, 2)
ActiveCell.Formula = "=IF(ISERROR(" & MyFormula & "),"""",(" & MyFormula & "))"

Excel's =Mid() function works differently than VBA's Mid function. You don't
need to specify that last parm.

StephanieH wrote:

I've tried both options and end up with the same thing. MyFormula = "ode"

Here's exactly how I have it written (with the option since it was the last
one tried)

MyFormula = Mid(ActiveCell.Formula, 2, Len(ActiveCell.Formula))
ActiveCell.Formula = "=IF(ISERROR(" & MyFormula & "),"",(" & MyFormula & "))"

Also if it helps here's what I'm changing from and to:
=AVERAGE(OFFSET(C15,-3,0,-12,1))
=IF(ISERROR(AVERAGE(OFFSET(C15,-3,0,-12,1))),"",(AVERAGE(OFFSET(C15,-3,0,-12,1))))

"StephanieH" wrote:

I need to sum column B if column A does not contact the words Large Balance.
I'm not sure how or where to designate the not like part.

Application.WorksheetFunction.SumIf(Columns("A") , < "Large Balance",
Columns("B"))
returns a syntax error


--

Dave Peterson


All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com