If you can write an Excel formula, you can build your own function.