View Full Version : [SOLVED:] Create simplified function
sassora
01-28-2011, 04:41 AM
Hi, is there a way of creating a function that can that summarise this array formula?
Function SUMELIG(ByVal rngElig As Range, rngPercentage As Range)
SUMELIG.FormulaArray = "=SUM(IF(ISERROR(rngElig * rngPercentage),0, rngElig))"
End Function
Thanks R
sassora
01-28-2011, 09:35 AM
The code quoted above doesn't work, any ideas? If there is a better non-vba way to deal with this then that's great.
Thanks
Bob Phillips
01-28-2011, 11:41 AM
Is this what you want
Function SUMELIG(ByVal rngElig As Range, rngPercentage As Range)
SUMELIG = Application.Evaluate(SUM(IF(ISERROR(" & rngElig.Address & " * " & rngPercentage.Address & "),0, " & rngElig.Address & "))"
End Function
sassora
01-28-2011, 01:40 PM
Thanks, it seems to be but the second line comes up in red, can you help?
sassora
01-28-2011, 02:45 PM
Here is the solution that seems to work, thanks XLD
Function SUMELIG(ByVal rngElig As Range, rngPercentage As Range)
SUMELIG = Application.Evaluate("SUM(If(ISERROR(" & rngElig.Address & " * " & rngPercentage.Address & "),0, " & rngElig.Address & "))")
End Function
Bob Phillips
01-28-2011, 04:19 PM
Oops, what a plonker (me!) :(
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.