Is it possible to create a custom function for use in Equations?

I've searching the forums but I don't quite see what I'm after - maybe I missed it...

I need to use the Mod function for calculating spacing and I was hoping to just use an equation to maintain an array but I don't see Mod in the function list.  I can write a function in VBA - is there a way to use it in the equation editor?

Thanks for any help.

SolidworksApi macros