# How do I define custom functions formula?

Writing custom functions is useful when you want to re-use custom formulas multiple times. Select “Edit” from the main menu at the top of the application, and click “User defined functions.”

The Function editor window will pop up:

The main window allows you to define a function.

A simple example could be:

.gdpru(x)=(x/rugdp)*100

This function calculates what % of the Russian GDP is covered by series x. In this case, .gdpru is the formula’s name, and (x) is the parameter it takes in. After saving this formula, you can use it in the Series list by substituting x for any series. For example:

.gdpru(rugpfi0026)

Which will yield the Russian debt to GDP ratio.

More complex formulas can be created and stored. For a run through of this feature, have a look to the video, here.