What is your calculation basis? That is if you were working it out on paper, what method would you use to go from weekly to monthly and weekly to annual? There are many different ways to do it, and you must use the method your accountant or finance office recommend.
The idea is:
1. Amount Entered
2. Frequesncy chosen ( weekly Monthly Annually ) from drop down list
3. This figure is calculated to fill automatically the Weekly, Monthly & annual colums.
The figures above in Weekly Monthly Annual columns have been manually entered so that you can see what I am trying to do.
The figures in the image were just manually input in the WEEKLY, MONTHLY and ANNUAL columns, so that I could show what I wanted to appear, based on the inputs in the AMOUNT & FREQUENCY COLUMNS.
My knowledge is limited but tried the following formula in the weekly column, which ofcourse does not work.
var v1 = this.getField("Amount").value;
var v2 = this.getField("Frequency").value;
if( v2 = "weekly" ) event.value = Amount;
else if( v2 = "monthly" ) event.value = Amount * 12 / 52;
else if( v2 = "annually" ) event.value = Amount / 52;
else event.value = 0;
As I said, give me MS excel, I can write formaula's till hell freezes over but with Adobe, it another story.
Ok... the pull down thing could make it pretty complicated and send you round in circles, but your code looks quite plausible. I can however see an error that catches out everyone.
To see if values are equal, never, never just use on equals sign = because it doesn't do what you think and breaks everything!
Thanks for all your help. Formulas worked and worksheet is complete.