Forum

UDF to Replicate Su...
 
Notifications
Clear all

UDF to Replicate SumIf

4 Posts
2 Users
0 Reactions
112 Views
(@james1989)
Posts: 5
Active Member
Topic starter
 

Hi,

Let's assume SUMIF does not exist ...

Could a UDF replicate exactly SUMIF ?

With MySumIf (range, criteria, sumrange) as a reference "UDF Mold" , this would allow to design twisted UDFs for very specific needs.

It is mainly the way to handle the behaviour of the criteria which looks like a headache ...

Thanks a lot for your insight

 
Posted : 26/02/2023 3:45 pm
(@keebellah)
Posts: 373
Reputable Member
 

I'm not sure as of which version SUMIF was first introduced but the simplest way is to understand how it works and then you can write your own custom function for it. Of course this also depends on your own coding experience and knoledge but don't let that hold you back since VBA coding is in essential the same as telling the macro what you want to do
This link explains the SUMIF and SUMIFS funtions

Excel SUMIF and SUMIFS – Explained

Maybe it helps 

 
Posted : 27/02/2023 3:42 am
(@james1989)
Posts: 5
Active Member
Topic starter
 

Hi,

Thanks a lot for the explanation on how to use SUMIF

But my objective is to replicate exactly the way SUMIF operates with a tailor-made UDF.

The main obstacle is to deal with criteria and their operators (=,<,>,<>) which can be potentially included in the definition of the criteria ...

 
Posted : 27/02/2023 6:34 am
(@keebellah)
Posts: 373
Reputable Member
 

Well, you coul start with recording a macro and then edit it to your needs.

That way you can see how the code is built up.

What's you excel version?

 
Posted : 28/02/2023 4:18 pm
Share: