Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am always curious how some of the functions I use in excel were written, and think it would help at times to see how it was done.

Does anyone know where there is example vba that replicates what some of these functions do? vlookup, hlookup, dsum, index, actually any or most would be interesting.

share|improve this question
They are likely to be written in C not VBA – Mark Jun 12 '10 at 21:35

In Chapter 10 of Microsoft Excel 2000 Power Programming with VBA, Walkenbach writes a VBA function to emulate SUM. I presume it's in later versions too, but I don't own them. The exercise is intended to demonstrate the complexity of the built-in functions and to teach some defensive programming techniques.

I haven't seen this done on the web or with any other Excel functions. But it would be interesting.

share|improve this answer
That is exactly what I was hoping to find somewhere. Thanks much.+1 – datatoo Jun 14 '10 at 15:08
Note this is writing the equivalent and not necessarily how MS did it. – Mark Jun 15 '10 at 12:39
I understand. It is enlightening to see how others write UDF and I was hoping there was a site that showed examples. It would be nice to find how MS did it, but I would settle for others as well. Thanks – datatoo Jun 21 '10 at 15:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.