Cognito-forms – Converting a currency field to a monthly or yearly amount

cognito-forms

I'm creating an expense form which asked for costs but in either monthly or yearly amounts. I was thinking I would first create a currency field to ask for the amount. Then add a Choice Box with two options "Monthly" or "Yearly" to designate what that amount is. I will have a list of these expenses such as utilities, insurance, etc.

So at the end of the form, I want to be able to calculate their total expenses. But how do I calculate if an amount is a monthly or yearly value? If it's monthly, then multiply by 12, or yearly, divide by 12. That way I can provide total expenses in monthly and yearly numbers.

Best Answer

I am a developer for Cognito Forms.

Assume you have a Currency field called Utilities and a Choice field called Timeframe, with the options Monthly and Yearly. Your calculations would then be:

Monthly Amount

=Utilities / (Timeframe = "Monthly" ? 1 : 12)

Yearly Amount

=Utilities * (Timeframe = "Yearly" ? 1 : 12)

And of course you can just keep adding on additional items to the calculation for each type of cost.