Feb 09 2021
I'd like to create a function that reads the currency and converts it into a prefered currency if necessary.
For example, I have a table that includes a column with prices in different currencies (CHF and €).
If the price is in Euro I want it to be converted into CHF according to the defined exchange rate.
So far I got the following code:
Function EURO2CHF(Euro, Kurs)If Euro.NumberFormat = "€" ThenEURO2CHF = Euro * KursElseIf Euro.NumberFormat = "CHF" ThenEURO2CHF = Euro * 1End IfEnd Function
Does any one know why this is not working properly? As a solution I always get CHF -, so it converts the currency but it doesn't do the math.
Thanks for any advices
Feb 10 2021
@ExcelDIY Any particular reason why you want to use a User Defined Function for this kind of basic operation? A simple IF statement will do. See picture below.