Tidiest way to create Excel formula in Javascript -


I am working on this Excel spreadsheet and the main formula is given below. It's very easy, but I'm trying to work with JavaScript in an HTML form input field. Actually, the user should be able to put the number in the field and it displays the corresponding percentage, based on that number - using javascript. If less than 5000 or 5000 is equal to, then this 10% will be displayed if less than 5000 but less than 10000 will show this 20% or less. If more than 10000 will display 30%

  = IF (and (B2 and LT; = 5000), 10%, IF (and (B2> 5000 , B2 & lt; = 10000), 20%, IF (and (B2> 10000), 30%)))  

I did some startups on it but in them Get rid of it because there should be an easy way to do this.

Any help would be great!

Thank you!

  = IF (B2> 10000, 30%, IF (B2 & Gt (5000,20%, 10%))  

If using jQuery ...

  $ ('# button'). Change (function () {var n = parseInt ($ (this) .val ()); if (n> 10000) {$ ('. Output'). Val ('30% ');} And if ( N & gt; 5000) {$ ('Output'). Val ('20% '); and {$ (' Output '). Val ('10%';}}};  

body:


Comments