top of page

How to Create Your Own Excel Function | User-Defined Function

  • Jul 10, 2024
  • 1 min read

You can create many functions and even save it as an add-in. You can then make the add-in active and have access to all these functions! By using Visual Basic we can leverage the abilities of Excel and make our own functions.


  • Make sure you have DEVELOPER tool in your Excel (check my other blog post for that)


Step 1: Go to the DEVELOPER tab and click VISUAL BASIC


Step 2: Insert a MODULE


Step 3: Write a function


This example function explained:


Function Grade(ByVal score As Single)


Function is the keyword for creating a new function. "Grade" is the name of your excel function that you want to make. That you can name whatever you want. "ByVal score As Single" is the input. For this function, it takes in a number


If score= 90 Then

Grade = "a"


"If --- Then" makes an if -then function. You have to learn how to create your own code, so I won't go in too much depth for this one. But basically you can code in visual basic to make your own excel function


Step 4: Use the function


Go back to your excel spreadsheet and look at the data you have that you want to work with. Use the function by calling on it like any other.

=Grade(your input)


That is all! Pretty simple, right?

 
 
 

Recent Posts

See All

Comments


Send Me a Message, Let Me Know What You Think

Thanks for submitting!

© 2023 by Lisa Hadi

bottom of page