From the course: Excel for Engineering Professionals

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

How to write a proper user-defined function (UDF)

How to write a proper user-defined function (UDF) - Microsoft Excel Tutorial

From the course: Excel for Engineering Professionals

How to write a proper user-defined function (UDF)

- [Instructor] Engineers sometimes need to do complicated calculations which are very hard to do using Excel's built-in functions. Think about calculating the thermodynamic properties of water in all of its shapes, like ice, water, steam, supercritical, vapor, et cetera, and that at a given temperature and pressure. Excel offers several full-fledged programming languages to write user-defined functions. In this video, I will discuss UDFs written in VBA, as that is the easiest language to learn and it is best integrated with Excel. So how do you write a VBA UDF? It really is as easy as pie. You simply open the VBA editor, insert a new module into the Excel file that you need the UDF for, and start typing the UDF. We choose insert, module, and here's our user-defined function. I called it MyUDF, and all it does is return a piece of text with the current date and time appended. So how would you use this user-defined function?…

Contents